Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gen-country-plist.py « Scripts - github.com/mumble-voip/mumble-iphoneos.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 6b3e23be0ef8721a4601dff5d405b28a9341f5a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#!/usr/bin/env/python2.6
# -*- coding: utf-8 -*-
#
# Generate a country plist from the GeoLite GeoIP CSV file.
#

import sys
import plistlib

f = open('GeoIPCountryWhois.csv')
s = f.read()
lines = s.split('\n')
countries = {}
for line in lines:
	if not len(line):
		break
	elem = line.split(',')
	code = elem[4].strip('"')
	country = elem[5].strip('"')
	countries[code] = country
plistlib.writePlist(countries, 'Countries.plist')