File size: 451 Bytes
acc4386
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
with open('database/background/citySet.txt','r') as f:
    city_set = f.read().strip().split('\n')

with open('database/background/citySet_with_states.txt','r') as f:
    lines = f.read().strip().split('\n')
    data = []
    for unit in lines:
        if unit.split('\t')[0] in city_set:
            data.append(unit)

with open('database/background/citySet_with_states.txt','w') as f:
    for unit in data:
        f.write(unit + '\n')
    f.close()