gen_areacodes.py 422 B

1234567891011121314151617
  1. import dataset
  2. import traceback
  3. db = dataset.connect('mysql://choozmo:pAssw0rd@db.ptt.cx:3306/google_poi?charset=utf8mb4')
  4. cursor=db.query('select distinct keyword from shop_list2')
  5. lst=[]
  6. for c in cursor:
  7. print(c['keyword'])
  8. lst.append(c['keyword'])
  9. for l in lst:
  10. try:
  11. db.query('insert into google_poi.areacodes (select num,"'+l+'",0 from lat_lon_loc) ')
  12. except:
  13. traceback.print_exc()