I am trying a program where it has to parse the text file:qwer.txt and print the value before '=' and after ',':
qwer.txt
john.xavier=s/o john
jane.victory=s/o ram
output:
xavier
victory
My program shows the entire line,please help on how to display specific text after . and =
with open("qwer.txt", 'r') as my_file:
a = my_file.readlines()
for line in a:
for part in line.split():
if "=" in part:
print part.split(' ')[-1]
Please help! answers will be appreciated.
for part in line.split()(4th line in your example).split(".")somewhere...