以str1为例 str1 = “hellopythonhelloworld”
print(str1.title())
result: dlrowollehnohtypolleh
print(str1.upper())
result: HELLOPYTHONHELLOWORLD
print(str1.title())
result: Hellopythonhelloworld
print(str1.find('h', 18, 20))
result: -1
print(str1.rfind('l'))
result: 19
print(str1.index('w'))
result: 16
print(str1.replace('l', '2', 5))
result: he22opythonhe22owor2d
print(str1.split('l', 1))
result: ['he', 'lopythonhelloworld']
print(str1.rsplit('l', 1))
result: ['hellopythonhellowor', 'd']
print(str1.strip())
result: hellopythonhelloworld
print(str1[2:7])
result: llopy
print(str1[1::7])
result: eho
print(str1[1::7])
result: eho
print(str1[::-1])
result: dlrowollehnohtypolleh