Python 字符串操作和文件操作
以及其它Python能力补充
Python字符串操作
in和not in:
'x字符串' in 'y字符串' 返回布尔值
字符串操作方法
upper() isupper()
lower() islower()
isalpha() 字母 isalnum() 字母数字 isdecimal()数字 isspace() 空格 Tab istitle() 首字母大写单词
join() '#'.join(['A','B','C']) = 'A#B#C'
split() 'A#B#C'.split('#') = ['A','B','C']
rjust() ljust() center()
strip() rstrip() lstrip()
文件操作
shutil和os分别支持文件和文件系统操作
shutil.copy() 复制文件
shutil.copytree() 复制文件夹
shutil.move() 移动文件与重命名文件
shutil.rmtree() 删除目录与子目录
os.unlink() 删除文件
os.walk() 遍历目录
时间相关函数
time.time() 当前时间
time.sleep() 暂停
datetime 可获取year month day hour minute second属性
timedelta 时间段
Python其他能力
Python可以处理PDF、WORD、Excel、邮件、图片、Web数据,还有处理CSV和JSON数据的能力