12 2019 档案

摘要:文件名中不能有\/:*?"<>|这些符号 因为python存储的时候一直失败……就很糟心 下划线是可以的 希望对大家有所帮助 以上 阅读全文
posted @ 2019-12-30 09:32 醉生梦死_0423 阅读(170) 评论(0) 推荐(0) 编辑
摘要:首先引入time包 import time 然后获取当前时间戳 time_now = time.time() 将时间戳格式化为本地时间 time_now= time.locatetime(time.time()) 将此格式再格式化为标准时间样式 time_now = time.strftime('% 阅读全文
posted @ 2019-12-30 09:30 醉生梦死_0423 阅读(619) 评论(0) 推荐(0) 编辑
摘要:杭电oj并没有反爬 所以直接爬就好了 直接贴源码(参数可改,循环次数可改,存储路径可改) import requests from bs4 import BeautifulSoup import time def write_in_file(number,string):#output functi 阅读全文
posted @ 2019-12-30 09:25 醉生梦死_0423 阅读(429) 评论(0) 推荐(0) 编辑
摘要:基本操作,不再详述 直接贴源码(根据当前时间创建文件): import requests from bs4 import BeautifulSoup import time def input_to_file(number,time,str1): with open('D:\\python\\pyt 阅读全文
posted @ 2019-12-30 09:23 醉生梦死_0423 阅读(484) 评论(0) 推荐(0) 编辑
摘要:Python构造函数格式为__init__() 注:下划线为两个而不是一个 可以有无参构造 instance: class city: def printout(self,first,second): print(first+second) demo = city() demo.printout(1 阅读全文
posted @ 2019-12-25 14:45 醉生梦死_0423 阅读(243) 评论(0) 推荐(0) 编辑