geonames is nice. an export tool based on geonames:
https://github.com/yosoyadri/GeoNames-XML-Builder
https://github.com/yosoyadri/GeoNames-XML-Builder/blob/master/continents-countries-statesprovinces.xml
there's also the excellent pycountry module:
http://pypi.python.org/pypi/pycountry