appending a line to a list based off of a string found in a previous list

Pedro Vincenty vincentypedro at gmail.com
Sat Dec 12 16:48:29 EST 2015


Hello, I'm wondering how to append a line from a file onto a list(easy part) provided that the line contains strings specific to a previous list I've already made(hard part).  I have this right now, 
for line in satellite_dataread:
        if any(i in line for i in list2):
            line= line.strip()
            satellite, country= line.split(',')
            satellite_origin_list.append(country)

the statement if statement seems to work as I take it out of the for loop, but not as I have it presented. Thanks a bunch!!



More information about the Python-list mailing list