hey = 'Shafni Glenn Ann Joseph'
stuff = hey.split()
print(stuff)
prints, (this is an easy function which helps us more)
['Shafni', 'Glenn', 'Ann', 'Joseph']
for stuffs in stuff :
print(stuffs)
prints, (we can use this and it line breaks and prints the names)
['Shafni', 'Glenn', 'Ann', 'Joseph'] Shafni Glenn Ann Joseph
print(stuff[0])
Shafni
hey = 'Shafni;Glenn;Ann;Joseph'
stuff = hey.split()
print(stuff)
['Shafni;Glenn;Ann;Joseph']
hey = 'Shafni;Glenn;Ann;Joseph'
stuff = hey.split(';')
print(stuff)
['Shafni', 'Glenn', 'Ann', 'Joseph']
Double split pattern
mail = ('[email protected] sat jan 2022')
words = mail.split()
email = words[0]
pieces = email.split('@')
print(pieces)
$ C:/python/Python311/python.exe "c:/Users/LENOVO/OneDrive/Desktop/python/python folder/hello.py" ['shafninasar200508', '[gmail.com](<http://gmail.com/>)']
mail = ('[email protected] sat jan 2022')
words = mail.split()
email = words[1]
pieces = email.split('@')
print(pieces)