10个Python函数,可以用于字符串操作
1. str.upper(): This function converts all characters of a string to uppercase.
2. str.lower(): This function converts all characters of a string to lowercase.
3. str.capitalize(): This function capitalizes the first character of a string.
4. str.title(): This function capitalizes the first character of each word in a string.
5. str.replace(old, new): This function replaces all occurrences of old with new in a string.
6. str.startswith(prefix): This function returns True if a string starts with prefix, else False.
7. str.endswith(suffix): This function returns True if a string ends with suffix, else False.
8. str.strip(characters): This function removes leading and trailing occurrences of characters from a string.
9. str.split(separator): This function splits a string into a list of substrings separated by separator.
10. str.join(iterable): This function concatenates a list of strings in iterable into a single string, separated by a delimiter string (str in this case).
