On Feb 7, 5:23 am, Terry Reedy wrote:
> John Machin wrote:
> > The UTF-n siblings are *external* representations.
> > 2.x: a_unicode_object.decode('UTF-16') -> an_str_object
> > 3.x: an_str_object.decode('UTF-16') -> a_bytes_object
>
> That should be .encode() to bytes, which is the coded form.
>
John Machin wrote:
The UTF-n siblings are *external* representations.
2.x: a_unicode_object.decode('UTF-16') -> an_str_object
3.x: an_str_object.decode('UTF-16') -> a_bytes_object
That should be .encode() to bytes, which is the coded form.
.decode is bytes => str/unicode
--
http://mail.python
"John Machin" wrote:
>By the way, has anyone come up with a name for the shifting effect
>observed above on str, and also with repr, range, and the iter*
>family? If not, I suggest that the language's association with the
>best of English humour be widened so that it be dubbed the "Mad
>Hatter's
John Machin wrote:
> On Feb 6, 9:24 pm, Chris Rebert wrote:
>> On Fri, Feb 6, 2009 at 1:49 AM, Kalyankumar Ramaseshan
>>
>> wrote:
>>
>>> Hi,
>>> Excuse me if this is a repeat question!
>>> I just wanted to know how are strings represented in python?
>>> I need to know in terms of:
>>> a) String
On Feb 6, 9:24 pm, Chris Rebert wrote:
> On Fri, Feb 6, 2009 at 1:49 AM, Kalyankumar Ramaseshan
>
> wrote:
>
> > Hi,
>
> > Excuse me if this is a repeat question!
>
> > I just wanted to know how are strings represented in python?
>
> > I need to know in terms of:
>
> > a) Strings are stored as UT
Hi,
Kalyankumar Ramaseshan wrote:
Hi,
Excuse me if this is a repeat question!
I just wanted to know how are strings represented in python?
It depents on if you mean python2.x or python3.x - the model
changed.
Python 2.x knows str and unicode - the former a sequence
of single byte character
On Fri, Feb 6, 2009 at 1:49 AM, Kalyankumar Ramaseshan
wrote:
>
> Hi,
>
> Excuse me if this is a repeat question!
>
> I just wanted to know how are strings represented in python?
>
> I need to know in terms of:
>
> a) Strings are stored as UTF-16 (LE/BE) or UTF-32 characters?
IIRC, Depends on wha
Hi,
Excuse me if this is a repeat question!
I just wanted to know how are strings represented in python?
I need to know in terms of:
a) Strings are stored as UTF-16 (LE/BE) or UTF-32 characters?
b) They are converted to utf-8 format when it is needed for e.g. when storing
the string to disk o
At 2008-06-24T20:27:33Z, regex_jedi <[EMAIL PROTECTED]> writes:
> Notice that the 4th value has a single quote in it. Well, I need to
> make sure that the single quote is escaped before handing it off for
> further processing to a class I later call for some other processing.
Out of curiosity, wh
Le Tuesday 24 June 2008 22:27:33 regex_jedi, vous avez écrit :
> ok, I have looked a lot of places, and can't seem to get a clear
> answer...
>
> I have a string called
>each_theme
>
> Some values of the string may contain a single quote as in -
>Happy
>Sad
>Nice
>Frank's Laundr
Dan Bishop a écrit :
On Jun 24, 4:04 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
Are you trying to escape for a regular expression?
Just do re.escape().
print re.escape('Happy')
Happy
print re.escape("Frank's Diner")
Frank\'s\ Diner
If you're escaping for URLs, there's urllib2.quot
On Jun 24, 4:04 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Are you trying to escape for a regular expression?
>
> Just do re.escape().
>
> >>> print re.escape('Happy')
> Happy
> >>> print re.escape("Frank's Diner")
>
> Frank\'s\ Diner
>
> If you're escaping for URLs, there's urllib2.quote
Are you trying to escape for a regular expression?
Just do re.escape().
>>> print re.escape('Happy')
Happy
>>> print re.escape("Frank's Diner")
Frank\'s\ Diner
If you're escaping for URLs, there's urllib2.quote(), for a command
line, use subprocess.list2cmdline.
Generally, the module that consu
ok, I have looked a lot of places, and can't seem to get a clear
answer...
I have a string called
each_theme
Some values of the string may contain a single quote as in -
Happy
Sad
Nice
Frank's Laundry
Explosion
Notice that the 4th value has a single quote in it. Well, I need to
14 matches
Mail list logo