Python 3.4 - String Methods

String Methods are built in to python 3.4. You don't need to import a module. String methods allow you to modify a string in many ways:

https://docs.python.org/2.4/lib/string-methods.html

strDummy = 'Knights who say ni'
print(strDummy.lower())


strDummy = 'Knights who say ni'
print(strDummy.replace('s', 't'))

This would split the string and get rid of the letter specified, but only once:

strDummy = 'Knights who say ni'
print(strDummy.split('n', 1))

['K', 'ights who say ni']


https://www.youtube.com/watch?v=aJeb1j_dlOA

Comments

Popular posts from this blog

Python 3.4 - Caesar Cipher

UML - Use Case Diagram