[Tutor] unichr not working as expected

Jim Mooney cybervigilante at gmail.com
Mon Jul 22 21:22:35 CEST 2013


On 22 July 2013 11:52, Alan Gauld <alan.gauld at btinternet.com> wrote:

> On 22/07/13 19:14, Jim Mooney wrote:
>
>           zark += unichr(ord(x)-45)
>>
>>
>> unichr() arg not in range(0x10000) (narrow Python build)
>>
>
>
> What if ord() is returning a value less than 45?
> What does unichr() do with negative vales?>
>
> Just a guess...
>

I already changed to u for the char, so I got a bigger number, and only
subtracted 3 from umlaut, which should have given me the dos line-drawing
dash, but now my problem is I can't seem to set encoding for that:

import sys
sys.setdefaultencoding('cp437')

gives me the error:

AttributeError: 'module' object has no attribute 'setdefaultencoding'

Jim




>
> --
> Alan G
> Author of the Learn to Program web site
> http://www.alan-g.me.uk/
>
> ______________________________**_________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/**mailman/listinfo/tutor<http://mail.python.org/mailman/listinfo/tutor>
>



-- 
Jim

What the Nations of the World Fail to Realize, is That we are Living in a
Closed System:

In March 2013, researchers from the Stanford University Hopkins Marine
Station issued a report on Bluefin tuna caught off the California coast and
tested for radioactive cesium. The report found that Bluefin tuna were 100
per cent contaminated, that not one was cesium-free. The report did not
address such questions as whether cesium would continue to accumulate in
tuna or whether it was appearing in other fish species.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130722/da3bebb7/attachment.html>


More information about the Tutor mailing list