Find data stored after certain string - Python -
im trying find way data stored @ end of string in .txt file using python. e.g:
bob: 22 jeff: 35 how tell python ask bobs age. not entire string.
thanks torin
if content of a.txt file like
bob: 22 jeff: 35 then code should work
file1 = open("a.txt","r") # open file reading lines = file1.readlines() #get each line readlines array of lines line in lines: data = line.split(":")[1] # split line : second part # data want reach
Comments
Post a Comment