随笔分类 - python
摘要:match()函数是在string的开始位置匹配,如果不匹配,则返回Nonesearch()会扫描整个string查找匹配;也就是说match()只有在0位置匹配成功的话才有返回,例如:print(re.match(‘super’, ‘superstition’).span()) 会返回(0, 5...
阅读全文
摘要:1. python中使用shell命令有多种方法,我自己觉得比较好用的是用commands模块:import commandsa,b = commands.getstatusoutput("ls -Al")a是退出状态(int类型), b是shell 命令的输出结果python -> shell:1...
阅读全文
浙公网安备 33010602011771号