python常用模块

一、time模块

time.time()   //时间戳

t = time.localtime()          //将一个时间戳转换为当前时区

二 、random模块

随机生成内容

random.randint(1, 3)        //随机生成传入参数范围内的数字 即 1,2,3

三、sys模块

sys.platform                 //返回操作系统平台名称

sys.stdin.readline()       //读取一行

四、os模块

os模块是与操作系统交互的一个接口

os.getcwd() 获取当前工作目录,即当前python脚本工作的目录路径

os.curdir  返回当前目录: ('.')

os.environ  获取系统环境变量

五、math

math.sqrt(one_num) //开平方

六、re模块

ret=re.findall('abc{1,4}','abccc')

print(ret)#['abccc'] 贪婪匹配

七、logging模块

logging.debug('debug message')

logging.info('info message')

logging.warning('warning message')

logging.error('error message')

logging.critical('critical message')

 

 

 

 

 

 

 

 

posted on 2019-09-05 17:25  竹径风声 阅读( ...) 评论( ...) 编辑 收藏

转载于:https://www.cnblogs.com/girl1314/p/11468458.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值