摘要: 详见:https://www.cnblogs.com/Nicholas0707/p/9021672.html#_label0 阅读全文
posted @ 2019-09-11 16:45 itheone 阅读(81) 评论(0) 推荐(0)
摘要: 正则表达式(re模块)是一种小型的,高度专业化的编程语言。(在python中)它内嵌在python中,并通过re模块实现。正则表达式模块被编译成一系列字节码,然后由用c编写的匹配引擎执行。 import res ="hellopythonworldworl2worworllpyddon"# prin 阅读全文
posted @ 2019-09-10 15:37 itheone 阅读(183) 评论(0) 推荐(0)
摘要: 本博客非本人所写,转载他人。 JSON(Java Script Object Notation):一种轻量级数据交互格式,相对于XML而言更简单,也易于阅读和编写,机器也方便解析和生成,Json是JavaScript中的一个子集。python的json模块序列化与反序列化的过程分别是encoding 阅读全文
posted @ 2019-09-06 16:04 itheone 阅读(165) 评论(0) 推荐(0)
摘要: 本模块非本人写,转自他人博客。 sys.argv #命令行参数List,第一个元素是程序本身路径 sys.exit(n) #退出程序,正常退出时exit(0) sys.version #获取Python解释程序的版本信息 sys.maxint #最大的Int值 sys.exit([arg]) #程序 阅读全文
posted @ 2019-09-06 11:50 itheone 阅读(167) 评论(0) 推荐(0)
摘要: print(os.getcwd()) #当前文件目录 print(os.listdir(os.getcwd())) #当前路径下的所有文件和子目录 print(os.path.split(os.getcwd(path))) #将目录分为目录和文件名 print(os.path.join(path,p 阅读全文
posted @ 2019-09-05 14:49 itheone 阅读(104) 评论(0) 推荐(0)
摘要: random.random(); #随机出现(0,1)内的浮点数; random.randint(1,3); #随机出现[1,3]内的整数; random.randrange(1,3); #随机出现[1,3)内的整数,即1,2; random.choice([1,2,3]); #随机在列表里抽取1个 阅读全文
posted @ 2019-09-04 11:06 itheone 阅读(134) 评论(0) 推荐(0)
摘要: 时间两种原始格式 1. 时间戳:是一种浮点数格式,从1970年到现在的秒数。 代码:time.time(); 2.结构化时间:是一种固定格式的时间格式。 代码:time.localtime(); 结构如下: time.struct_time(tm_year=2019, tm_mon=9, tm_md 阅读全文
posted @ 2019-09-03 17:28 itheone 阅读(204) 评论(0) 推荐(0)