test = "123abcefsdfa"
print(test.replace("123","___"))
___abcefsdfa
test = "asdfgVBNMK"
print(test.swapcase())
ASDFGvbnmk
print(test.upper())
print(test.lower())
ASDFGVBNMK
asdfgvbnmk
test = "123,456,789"
print(test.split(","))
print(test.split(",",1))
['123', '456', '789']
['123', '456,789']
print(test.partition(","))
print(test.rpartition(","))
('123', ',', '456,789')
('123,456', ',', '789')
test = "12345672"
print(test.find("2"))
print(test.rfind("2"))
print(test.find("a"))
1
7
-1
print(test.index("2"))
print(test.rindex("2"))
print(test.index("a"))
1
7
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-17-af7b2106d969> in <module>()
2 print(test.index("2"))
3 print(test.rindex("2"))
----> 4 print(test.index("a"))
ValueError: substring not found