Re: Why does the "".join(r) do this?
From: Peter Otten (__peter___at_web.de)
Date: 05/20/04
- Next message: Jeff Learman: "Re: shell script stdout to python string?"
- Previous message: Irmen de Jong: "ANN: kronos, a task scheduler"
- In reply to: John Roth: "Re: Why does the "".join(r) do this?"
- Next in thread: Peter Otten: "Re: Why does the "".join(r) do this?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 20 May 2004 23:13:29 +0200
John Roth wrote:
> "Ivan Voras" <ivoras@__geri.cc.fer.hr> wrote in message
> news:c8itrm$epg$1@bagan.srce.hr...
>> Is there a way to change the default codec in a part of a program?
>> (Meaning that different parts of program deal with strings they know are
>> in a specific different code pages?)
>
> Does the encoding line (1st or second line of program) do this?
> I don't remember if it does or not - although I'd suspect not.
> Otherwise it seems like a reasonably straightforward function
> to write.
As a str does not preserve information about the encoding, the
# -*- coding: XXX -*-
comment does not help here. It does however control the decoding of unicode
strings. I suppose using unicode for non-ascii literals plus the above
coding comment is as close as you can get to the desired effect.
With some more work you could probably automate string conversion like it is
done with quixote's htmltext. Not sure if that would be worth the effort,
though.
Peter
- Next message: Jeff Learman: "Re: shell script stdout to python string?"
- Previous message: Irmen de Jong: "ANN: kronos, a task scheduler"
- In reply to: John Roth: "Re: Why does the "".join(r) do this?"
- Next in thread: Peter Otten: "Re: Why does the "".join(r) do this?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|