Yet another text-format error in python (personal error, of course)... while I was trying to store in file a joined list (through list comprehension), one or more of the characters of one the fields that are being joined generate the following 'friendly message':
Traceback (most recent call last):
File "stations.py", line 62, in
exit(main())
File "stations.py", line 16, in main
record.append(str(element.text))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in position 7: ordinal not in range(128)
repr(object)
Return a string containing a printable representation of an object.
(http://docs.python.org/library/functions.html)
Example:
>>> caca = u'\u2603'
>>> print caca
☃
>>> str(caca)
Traceback (most recent call last):
File "
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2603' in position 0: ordinal not in range(128)
>>> repr(caca)
"u'\\u2603'"
solution from:
http://blog.codekills.net/archives/45-str...-yer-probably-doin-it-wrong..html