--> -->

随笔分类 -  python常见技巧

摘要:import argparse # (1) 声明一个parser parser = argparse.ArgumentParser() # (2) 添加参数 parser.add_argument("parg") # 位置参数,这里表示第一个出现的参数赋值给parg parser.add_argum 阅读全文
posted @ 2022-11-21 11:39 柠鸢 阅读(38) 评论(0) 推荐(1) 编辑
摘要:提供两种定时任务的方式 1.BlockingScheduler from apscheduler.schedulers.blocking import BlockingScheduler sched = BlockingScheduler() #每隔300秒执行一次任务 sched.add_job( 阅读全文
posted @ 2022-11-21 11:26 柠鸢 阅读(96) 评论(0) 推荐(0) 编辑
摘要:写了一个GK2A卫星数据爬取的程序,本身不难,记录下小知识。 根据URL下载文件,有些需要cookie,大文件下载防止文件损坏 headers = { "Content-Type": ContentType, "User-Agent": UA, "Cookie": cookie } response 阅读全文
posted @ 2022-10-18 15:53 柠鸢 阅读(204) 评论(0) 推荐(1) 编辑
摘要:本次工作使用爬虫,其中需要用到时间函数,进行时间格式转化,确定本地时间等,记录一下 datetime函数 now_time = datetime.datetime.now() #确定当前时间 end_date = now_time.strftime("%Y-%m-%d")#将时间格式转化为如2022 阅读全文
posted @ 2022-09-23 10:37 柠鸢 阅读(46) 评论(0) 推荐(0) 编辑