随笔分类 -  python

摘要:常用函数: import time time.time() #时间戳time.clock() #time.sleep() #休眠,括号()内加休眠的秒数time.strftime() #把时间格式转换成指定格式,str类型time.gmtime() #UTC时区时间(0时区),用法与time.loc 阅读全文
posted @ 2018-11-07 20:29 WhiteMouse 阅读(156) 评论(0) 推荐(0)
摘要:1、只有在unicode下才能将utf-8与gbk互转2、unicode是在内存中使用,bytes是文件存储和网络传输时使用 py3时:a="中国" 和a=u"中国" 是一个意思,都表示str类型unicode存储类型,即默认是unicode存储类型c=b"中国" 表示str类型bytes存储类型 阅读全文
posted @ 2018-11-07 20:22 WhiteMouse 阅读(994) 评论(0) 推荐(0)
摘要:引入父级目录目录结构: print_father.py引入上级目录father.py模块的sentence变量,代码如下:#注:需要引入的文件 E:\test\test176\test186\grandfather.py import syssys.path.append(r'E:\test\tes 阅读全文
posted @ 2018-11-07 20:15 WhiteMouse 阅读(291) 评论(0) 推荐(0)
摘要:2个模块在同一个包内时(即引入和被引入的2个py文件在同一个目录下),直接引入模块名 1、引入与被引入模块或包在同一目录下时,直接引入模块名或者包名import modulename.py或者import packagename示例:文件层级: ①模块print_parameters.py引入par 阅读全文
posted @ 2018-11-07 20:11 WhiteMouse 阅读(13324) 评论(0) 推荐(0)