I have a file with many lines formatted as such:
DIV ID=0X78800009 EXT="LOS ANGELES" TY=STANDARD OWN=0X74400002 ABBR=LA
I need to pull out the EXT value, but only the part in quotes. I'm currently using this:
for line in file:
if sub in line:
extlist.append([item[4:] for item in line.split() if item.startswith('EXT=')].pop())
But it only appends the "LOS" part of LOS ANGELES to idlist. I'm a little new to python, but is there a way to wrap item[4:]
in str(item[4:])
and use string functions to extract the value i need?
As a note, the text in the EXT field varies in length, they are all random city names.