Python data type, python
1. Remove blank strings, strip (), including spaces, tab keys, line breaks
>>> name = " Frank ">>> name.strip()'Frank'
2. split string ("separator"), which is a list after grouping
>>> name = "Apple, banbana, orice">>> name.split(",")['Apple', ' banbana', ' orice']>>>
3. String merge join ("connector ")
>>> name = ['Frank', 'Marlon', 'Lee']>>> "|".join(name)'Frank|Marlon|Lee'
4. Determine whether the space is "in" in the substring"
>>> name = "Frank Bain">>> '' in nameTrue>>> "L" in nameFalse>>>
5. Two string formatting formats
# First expression method >>> msg = "Hello {name}, your age is {age}" >>> msg. format (name = "Frank", age = 24) 'Hello Frank, your age is 24' >>># Method 2, note that index starts from 0 >>> msg = "Hello {0}, your age is {1}, sex is {2}" >>> msg. format ("Frank", 24, "man") 'hellofrank, your age is 24, sex is man' >>>
6. String judgment
>>> name = "Frank">>> name.upper()'FRANK'>>> name.lower()'frank'>>> name.startswith("F")True>>> name.endswith("k")True>>> name.endswith("a")False