最近在做一個天氣預報模塊,首先需要將客戶端公網ip轉換成所在城市,然後將所在城市名轉換成對應的城市代碼, 在網上找到了城市代碼,但是需要處理一下,看了看,有三百多城市及對應的城市代碼,想存到數據庫。就想著做一個 數據處理自動生成sql語句的工具,提高效率。
直轄市 "北京","上海","天津","重慶" "101010100","101020100","101030100","101040100" 特別行政區 "香港","澳門" "101320101","101330101" 黑龍江 "哈爾濱","齊齊哈爾","牡丹江","大慶","伊春","雙 鴨山","鶴崗","雞西","佳木斯","七台河","黑河 ","綏化","大興安嶺" "101050101","101050201","101050301","101050901","101050801&q uot;,"101051301","101051201","101051101","101050401","101051 002","101050601","101050501","101050701" 吉林 "長春","延吉","吉林","白山","白城","四平 ","松原","遼源","大安","通化" "101060101","101060301","101060201","101060901","101060601&q uot;,"101060401","101060801","101060701","101060603","101060 501" 遼寧 "沈陽","大連","葫蘆島","盤錦","本溪","撫順 ","鐵嶺","遼陽","營口","阜新","朝陽","錦州 ","丹東","鞍山" "101070101","101070201","101071401","101071301","101070501&q uot;,"101070401","101071101","101071001","101070801","101070 901","101071201","101070701","101070601","101070301" 內蒙古 "呼和浩特","呼倫貝爾","錫林浩特","包頭","赤峰 ","海拉爾","烏海","鄂爾多斯","通遼" "101080101","101081000","101080901","101080201","101080601&q uot;,"101081001","101080301","101080701","101080501" 河北 "石家莊","唐山","張家口","廊坊","邢台","邯鄲 ","滄州","衡水","承德","保定","秦皇島" "101090101","101090501","101090301","101090601","101090901&q uot;,"101091001","101090701","101090801","101090402","101090 201","101091101" 河南 "鄭州","開封","洛陽","平頂山","焦作","鶴壁 ","新鄉","安陽","濮陽","許昌","漯河","三門峽 ","南陽","商丘","信陽","周口","駐馬店" "101180101","101180801","101180901","101180501","101181101&q uot;,"101181201","101180301","101180201","101181301","101180 401","101181501","101181701","101180701","101181001","1 01180601","101181401","101181601" 山東 "濟南","青島","淄博","威海","曲阜","臨沂 ","煙台","棗莊","聊城","濟寧","菏澤","泰安 ","日照","東營","德州","濱州","萊蕪","濰坊 " "101120101","101120201","101120301","101121301","101120710&q uot;,"101120901","101120501","101121401","101121701","101120 701","101121001","101120801","101121501","101121201","1 01120401","101121101","101121601","101120601" 山西 "太原","陽泉","晉城","晉中","臨汾","運城 ","長治","朔州","忻州","大同","呂梁" "101100101","101100301","101100601","101100401","101100701&q uot;,"101100801","101100501","101100901","101101001","101100 201","101101101" 江蘇 "南京","蘇州","昆山","南通","太倉","吳縣 ","徐州","宜興","鎮江","淮安","常熟","鹽城 ","泰州","無錫","連雲港","揚州","常州","宿遷 " "101190101","101190401","101190404","101190501","101190408&q uot;,"101190406","101190801","101190203","101190301","101190 901","101190402","101190701","101191201","101190201","1 01191001","101190601","101191101","101191301" 安徽 "合肥","巢湖","蚌埠","安慶","六安","滁州 ","馬鞍山","阜陽","宣城","銅陵","淮北","蕪湖 ","毫州","宿州","淮南","池州" "101220101","101221601","101220201","101220601","101221501&q uot;,"101221101","101220501","101220801","101221401","101221 301","101221201","101220301","101220901","101220701","1 01220401","101221701" 陝西 "西安","韓城","安康","漢中","寶雞","鹹陽 ","榆林","渭南","商洛","銅川","延安" "101110101","101110510","101110701","101110801","101110901&q uot;,"101110200","101110401","101110501","101110601","101111 001","101110300" 寧夏 "銀川","固原","中衛","石嘴山","吳忠" "101170101","101170401","101170501","101170201","101170301&q uot; 甘肅 "蘭州","白銀","慶陽","酒泉","天水","武威 ","張掖","甘南","臨夏","平涼","定西","金昌 " "101160101","101161301","101160401","101160801","101160901&q uot;,"101160501","101160701","101050204","101161101","101160 301","101160201","101160601" 青海 "西寧","海北","海西","黃南","果洛","玉樹 ","海東","海南" "101150101","101150801","101150701","101150301","101150501&q uot;,"101150601","101150201","101150401" 湖北 "武漢","宜昌","黃岡","恩施","荊州","神農架 ","十堰","鹹寧","襄陽","孝感","隨州","黃石 ","荊門","鄂州" "101200101","101200901","101200501","101201001","101200801&q uot;,"101201201","101201101","101200701","101200201","101200 401","101201301","101200601","101201401","101200301" 湖南 "長沙","邵陽","常德","郴州","吉首","株洲 ","婁底","湘潭","益陽","永州","岳陽","衡陽 ","懷化","韶山","張家界" "101250101","101250901","101250601","101250501","101251501&q uot;,"101250301","101250801","101250201","101250701","101251 401","101251001","101250401","101251201","101250202","1 01251101" 浙江 "杭州","湖州","金華","寧波","麗水","紹興 ","衢州","嘉興","台州","舟山","溫州" "101210101","101210201","101210901","101210401","101210801&q uot;,"101210501","101211001","101210301","101210601","101211 101","101210701" 江西 "南昌","萍鄉","九江","上饒","撫州","吉安 ","鷹潭","宜春","新余","景德鎮","贛州" "101240101","101240901","101240201","101240301","101240401&q uot;,"101240601","101241101","101240501","101241001","101240 801","101240701" 福建 "福州","廈門","龍巖","南平","寧德","莆田 ","泉州","三明","漳州" "101230101","101230201","101230701","101230901","101230301&q uot;,"101230401","101230501","101230801","101230601" 貴州 "貴陽","安順","赤水","遵義","銅仁","六盤水 ","畢節","凱裡","都勻" "101260101","101260301","101260208","101260201","101260601&q uot;,"101260801","101260701","101260501","101260401" 四川 "成都","泸州","內江","涼山","阿壩","巴中 ","廣元","樂山","綿陽","德陽","攀枝花","雅安 ","宜賓","自貢","甘孜州","達州","資陽","廣安 ","遂寧","眉山","南充" "101270101","101271001","101271201","101271601","101271901&q uot;,"101270901","101272101","101271401","101270401","101272 001","101270201","101271701","101271101","101270301","1 01271801","101270601","101271301","101270801","101270701",&q uot;101271501","101270501" 廣東 "廣州","深圳","潮州","韶關","湛江","惠州 ","清遠","東莞","江門","茂名","肇慶","汕尾 ","河源","揭陽","梅州","中山","德慶","陽江 ","雲浮","珠海","汕頭","佛山" "101280101","101280601","101281501","101280201","101281001&q uot;,"101280301","101281301","101281601","101281101","101282 001","101280901","101282101","101281201","101281901","1 01280401","101281701","101280905","101281801","101281401",&q uot;101280701","101280501","101280800" 廣西 "南寧","桂林","陽朔","柳州","梧州","玉林 ","桂平","賀州","欽州","貴港","防城港","百色 ","北海","河池","來賓","崇左" "101300101","101300501","101300510","101300301","101300601&q uot;,"101300901","101300802","101300701","101301101","101300 801","101301401","101301001","101301301","101301201","1 01300401","101300201" 雲南 "昆明","保山","楚雄","德宏","紅河","臨滄 ","怒江","曲靖","思茅","文山","玉溪","昭通 ","麗江","大理" "101290101","101290501","101290801","101291501","101290301&q uot;,"101291101","101291201","101290401","101290901","101290 601","101290701","101291001","101291401","101290201" 海南 "海口","三亞","儋州","瓊山","通什","文昌" "101310101","101310201","101310205","101310102","101310222&q uot;,"101310212" 新疆 "烏魯木齊","阿勒泰","阿克蘇","昌吉","哈密","和 田","喀什","克拉瑪依","石河子","塔城","庫爾勒 ","吐魯番","伊寧" "101130101","101131401","101130801","101130401","101131201&q uot;,"101131301","101130901","101130201","101130301","101131 101","101130601","101130501","101131001" 西藏 "拉薩","阿裡","昌都","那曲","日喀則","山南 ","林芝" "101140101","101140701","101140501","101140601","101140201&q uot;,"101140301","101140401" 台灣 "台北","高雄" "101340102","101340201" 城市代碼