- 博客(4)
- 收藏
- 关注
原创 2020-11-20
Python 编程快速上手filling the gaps 编写一个程序,在一个文件夹中,找到所有带指定前缀的文件,诸如spam001.txt, spam002.txt等,并定位缺失的编号(例如存在spam001.txt和spam003.txt,但不存在spam002.txt)。让该程序对所有后面的文件改名,消除缺失的编号。》(摘自由 斯维加特(Al Sweigart), 王海鹏 撰写的《Python编程快速上手——让繁琐工作自动化(异步图书)》 def copy_file(folder): whi
2020-11-20 12:17:08
154
原创 2020-11-10
Python 编程快速上手 疯狂填词 import re file = open(‘panda.txt’, ‘w’ ) file.write(‘The ADJECTIVE panda walked to the NOUN and then VERB. A nearby NOUN was affected by these events.’) file.close() file = open(‘panda.txt’) txt = file.read() file.close() txt_regex = re.
2020-11-10 15:52:04
132
1
原创 open() function
The open() function takes two parameters; filename, and mode. There are four different methods (modes) for opening a file: 读"r" - Read - Default value. Opens a file for reading, error if the file does not exist 追加"a" - Append - Opens a file for appending,
2020-11-03 22:03:18
337
原创 使用re.VERBOSE的一点注意事项
When converting your regex to re.VERBOSE mode make sure that: whitespace is escaped or replaced with some equivalent: \s or [ ] or '\ '(I had to put ‘’ here due to SO formatting). All plain whitespace is ignored with re.VERBOSE. hashes # are escaped or re
2020-10-24 20:01:34
1393
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅