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

Popular posts from this blog

Sort a complex associative array in PHP -

vb.net - How to ignore if a cell is empty nothing -

recursion - Can every recursive algorithm be improved with dynamic programming? -