1.分割字符串split
>>> filename = "iamge.png" >>> segments = filename.split(".") >>> segments[0] 'iamge' >>> segments[1] 'png'
2.查找特定字符串
>>> dir=r"C:Usersusernamehahaapphaha" #反向查找 >>> dir.rfind("haha") 27 #正向查找 >>> dir.find("haha") 18
3.拼接字符串
>>> "hello"+" python" 'hello python'