Pound sign problem

Lew Pitcher lew.pitcher at digitalfreehold.ca
Tue Apr 11 11:24:33 EDT 2017


Steve D'Aprano wrote:

> On Tue, 11 Apr 2017 12:50 am, Lew Pitcher wrote:
> 
>> David Shi wrote:
>> 
>>> In the data set, pound sign escape appears:
>>> u'price_currency': u'\xa3', u'price_formatted': u'\xa3525,000',
> 
> That looks like David is using Python 2.
> 
>>> When using table.to_csv after importing pandas as pd, an error message
>>> persists as follows: UnicodeEncodeError: 'ascii' codec can't encode
>>> character u'\xa3' in position 0: ordinal not in range(128)
>> 
>> There is no "pound sign" in ASCII[1]. Try changing your target encoding
>> to something other than ASCII.
> 
> Please don't encourage the use of old legacy encodings.

I wonder if you actually read my reply.

What in "Try changing your target encoding to something other than ASCII" is 
encouragement to use "old legacy encodings"?

> In 2017, unless you are reading from old legacy files created using a
> non-Unicode encoding, you should just use UTF-8.

Thanks for your opinion. My opinion differs.


-- 
Lew Pitcher
"In Skills, We Trust"
PGP public key available upon request





More information about the Python-list mailing list