在写自动化脚本时,通常需要进行字符串操作。
例如,需要根据输入的文件名,生成相对应的输出文件名。这时需要对字符串进行切割,合并等操作。
python字符串集合可以参考: https://www.jianshu.com/p/b758332c44bb
https://www.jiqizhixin.com/articles/2020-02-28-2
常见的操作
# 发现子字符串的首引索
str1 = "this is string example....wow!!!"
str2 = "exam"
print str1.find(str2) # 15