摘要:
import re s = 'birthday is 1991-11-19' res1 = re.sub('(\d{4})-(\d{2})-(\d{2})',r'\2/\3/\1',s) res2 = re.sub('(?P\d{4})-(?P\d{2})-(?P\d{2})',r'\g/\g/\g',s) print(res1) print(res2) 阅读全文
posted @ 2019-03-03 15:06
Ray_chen
阅读(401)
评论(0)
推荐(0)
摘要:
import os,stat # str.startswith() # 获取当前目录下以.py 或者.sh结尾的文件 l = [name for name in os.listdir('/shells/') if name.endswith(('.sh','py'))] print(l) # 获取文件的权限 for file in l: print(oct(os.stat('/s... 阅读全文
posted @ 2019-03-03 14:35
Ray_chen
阅读(11847)
评论(0)
推荐(0)
摘要:
map实现 re.split实现 阅读全文
posted @ 2019-03-03 12:04
Ray_chen
阅读(165)
评论(0)
推荐(0)
摘要:
1.传统方法 2.zip实现 3. chain实现 阅读全文
posted @ 2019-03-03 10:42
Ray_chen
阅读(221)
评论(0)
推荐(0)
摘要:
常规方法读取大文件时读取速度慢且可能造成内存不足 迭代读取 迭代器资源会消耗 阅读全文
posted @ 2019-03-03 10:28
Ray_chen
阅读(304)
评论(0)
推荐(0)

浙公网安备 33010602011771号