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 17:39:39 EST 2015


On Saturday, December 12, 2015 at 4:48:46 PM UTC-5, Pedro Vincenty wrote:
> 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!!
I was able to get it it you guys were right.  Thanks a bunch!



More information about the Python-list mailing list