1. 程式人生 > >字符串的子序列需要註意的問題

字符串的子序列需要註意的問題

必須 小寫 切片 log clas post pytho body pos

1 name = "Python"
2 if "P" in name: # 此處區分大小寫
3     print("P is in!") # P 是 name 的子字符串,子序列,必須連續的字符串切片,隔開的不行。
4 else:
5     print("is not in")

字符串的子序列需要註意的問題