边界匹配
^ 头
$ 尾
\A 串头
\Z 串尾
预定义字符集:
\d [0-9] 数字
\D [^0-9]
\s 匹配任何空白字符
\S匹配任何非空白字符
\w【A-Za-z0-9】
\W【^A-Za-z0-9】
下面记录一个xls存储:
import xlwt
book = Workbook(encoding='utf-8') 导入
Sheet = book.add_sheet('new sheet')#新建一张表单
Sheet.write(0,0,'name')
Sheet.write(0,1,'马云杰')
book.save('onetest.xls')#存取退出
下面记录一个txt存储:
with open('desktop/1.txt','w') as f :
f.write('hello world\n')
f.write('when you try,you will get better!')
f.close()
总有一个理由,会让我们开始变强。