python 字符串
test_str = "hello python" # 查找字符串 temp = test_str.find("llo") print(temp) # 替换字符串(不会改变原来的字符串) temp2 = test_str.replace("python", "php") print(temp2)
test_str = " hello python " # 去掉两侧空格 temp = test_str.strip() print(temp)
test_str = "hello python php go" # 拆分字符串 temp = test_str.split() print(temp) # 合并字符串 temp2 = "*".join(temp) print(temp2)







浙公网安备 33010602011771号