Tkinter and astral characters (was: Decoding bytes to text strings in Python 2)

2024-06-24 Thread Peter J. Holzer via Python-list
On 2024-06-24 01:14:22 +0100, MRAB via Python-list wrote: > Tkinter in recent versions of Python can handle astral characters, at least > back to Python 3.8, the oldest I have on my Windows PC. I just tried modifying https://docs.python.org/3/library/tkinter.html#a-hello-world-program to display "

Re: Decoding bytes to text strings in Python 2

2024-06-23 Thread Chris Angelico via Python-list
On Mon, 24 Jun 2024 at 10:18, MRAB via Python-list wrote: > Tkinter in recent versions of Python can handle astral characters, at > least back to Python 3.8, the oldest I have on my Windows PC. Good to know, thanks! I was hoping that would be the case, but I don't have a Windows system to check o

Re: Decoding bytes to text strings in Python 2

2024-06-23 Thread MRAB via Python-list
On 2024-06-24 00:30, Chris Angelico via Python-list wrote: On Mon, 24 Jun 2024 at 08:20, Rayner Lucas via Python-list wrote: In article , ros...@gmail.com says... > > If you switch to a Linux system, it should work correctly, and you'll > be able to migrate the rest of the way onto Python 3. O

Re: Decoding bytes to text strings in Python 2

2024-06-23 Thread Chris Angelico via Python-list
On Mon, 24 Jun 2024 at 08:20, Rayner Lucas via Python-list wrote: > > In article , > ros...@gmail.com says... > > > > If you switch to a Linux system, it should work correctly, and you'll > > be able to migrate the rest of the way onto Python 3. Once you achieve > > that, you'll be able to operate

Re: Decoding bytes to text strings in Python 2

2024-06-23 Thread Rayner Lucas via Python-list
In article , r...@zedat.fu- berlin.de says... > > I didn't really do a super thorough deep dive on this, > but I'm just giving the initial impression without > actually being familiar with Tkinter under Python 2, > so I might be wrong! > > The Text widget typically expects text in Tcl

Re: Decoding bytes to text strings in Python 2

2024-06-23 Thread Rayner Lucas via Python-list
In article , ros...@gmail.com says... > > If you switch to a Linux system, it should work correctly, and you'll > be able to migrate the rest of the way onto Python 3. Once you achieve > that, you'll be able to operate on Windows or Linux equivalently, > since Python 3 solved this problem. At lea

Re: Decoding bytes to text strings in Python 2

2024-06-21 Thread Chris Angelico via Python-list
On Sat, 22 Jun 2024 at 03:28, Rayner Lucas via Python-list wrote: > I'm curious about something I've encountered while updating a very old > Tk app (originally written in Python 1, but I've ported it to Python 2 > as a first step towards getting it running on modern systems). > > I am using Python

Decoding bytes to text strings in Python 2

2024-06-21 Thread Rayner Lucas via Python-list
I'm curious about something I've encountered while updating a very old Tk app (originally written in Python 1, but I've ported it to Python 2 as a first step towards getting it running on modern systems). The app downloads emails from a POP server and displays them. At the moment, the code is

Re: Issue in parsing the strings in python code

2018-11-12 Thread srinivasan
Hi Thomas, I have Implemented as below, please let me know if you forsee any issues in the below code snippet?as I have just started learning python from last week def wifi_connect_verify(self): """ Verify Connectivity of WIFI module to the Access. :return: c

Re: Issue in parsing the strings in python code

2018-11-12 Thread Brian Oney via Python-list
On Mon, 2018-11-12 at 14:17 +, Rhodri James wrote: > On 12/11/2018 09:37, srinivasan wrote: > > Because the problem is every time when ever I see the output using the > > "nmcli c show", the below output is the weird output, so instead of > > connecting to SSID "NIFunkloch" it randomly connect

Re: Issue in parsing the strings in python code

2018-11-12 Thread Rhodri James
On 12/11/2018 09:37, srinivasan wrote: Because the problem is every time when ever I see the output using the "nmcli c show", the below output is the weird output, so instead of connecting to SSID "NIFunkloch" it randomly connects to "NIFunkloch 1552" or sometimes to NIFunkloch 1000" or so on r

Re: Issue in parsing the strings in python code

2018-11-12 Thread Thomas Jollans
On 2018-11-12 10:23, srinivasan wrote: > Hi Thomas, > > Great to hear from you, Could you please let me know how do I get the UUID > "1da7d068-4548-4446-bf88-a440e49db1b1" by passing the name of the SSID > "Funkloch' using "nmcli --terse" ?? Have a look at the output. It appears to me that the f

Re: Issue in parsing the strings in python code

2018-11-12 Thread srinivasan
Because the problem is every time when ever I see the output using the "nmcli c show", the below output is the weird output, so instead of connecting to SSID "NIFunkloch" it randomly connects to "NIFunkloch 1552" or sometimes to NIFunkloch 1000" or so on root:~/qa/robot_tests# nmcli c show NAME

Re: Issue in parsing the strings in python code

2018-11-12 Thread srinivasan
Hi Thomas, Great to hear from you, Could you please let me know how do I get the UUID "1da7d068-4548-4446-bf88-a440e49db1b1" by passing the name of the SSID "Funkloch' using "nmcli --terse" ?? Many thanks in advance, Srini On Mon, Nov 12, 2018 at 9:59 AM Thomas Jollans wrote: > On 12/11/2018 0

Re: Issue in parsing the strings in python code

2018-11-12 Thread Thomas Jollans
On 12/11/2018 09:28, srinivasan wrote: > Dear Python Experts team, > > This question might be very simple for you, As am newbie to python, could > you please how to parse the below strings > > [snip] > > > root:~/qa/robot_tests# nmcli c show Pro tip: many *nix tools have a flag that makes them

Re: Issue in parsing the strings in python code

2018-11-12 Thread Shakti Kumar
On Mon, 12 Nov 2018 at 14:02, srinivasan wrote: > Dear Python Experts team, > > This question might be very simple for you, As am newbie to python, could > you please how to parse the below strings > > 1. Could you please do the needful in guiding me, that how can I extract > the strings under th

Issue in parsing the strings in python code

2018-11-12 Thread srinivasan
Dear Python Experts team, This question might be very simple for you, As am newbie to python, could you please how to parse the below strings 1. Could you please do the needful in guiding me, that how can I extract the strings under the UUID column in python code in the below output (nmcli c show

Re: Immutability of Floats, Ints and Strings in Python

2016-11-28 Thread Random832
On Fri, Nov 25, 2016, at 06:33, Ned Batchelder wrote: > A Python implementation can choose when to reuse immutable objects and > when not to. Reusing a value has a cost, because the values have to > be kept, and then found again. So the cost is only paid when there's > a reasonable chance that the

Re: Immutability of Floats, Ints and Strings in Python

2016-11-25 Thread Steve D'Aprano
On Fri, 25 Nov 2016 10:37 pm, Ned Batchelder wrote: > And: floats are rarely checked for equality, and very very very rarely > used as dict keys, so there's no gain by short-circuiting the equality > check. You cannot short-circuit the equality check, at least not without giving up IEEE-754 seman

Re: Immutability of Floats, Ints and Strings in Python

2016-11-25 Thread Ned Batchelder
On Friday, November 25, 2016 at 7:17:08 AM UTC-5, BartC wrote: > On 25/11/2016 11:24, Nikunj wrote: > > > > Out of curiosity, I wanted to understand the reason behind having different > > memory location for two identical floats . This is unlike ints or strings. > > Tried googling but couldn't fi

Re: Immutability of Floats, Ints and Strings in Python

2016-11-25 Thread BartC
On 25/11/2016 11:24, Nikunj wrote: Out of curiosity, I wanted to understand the reason behind having different memory location for two identical floats . This is unlike ints or strings. Tried googling but couldn't find anything concrete. Any links or references would be appreciated! Do you

Re: Immutability of Floats, Ints and Strings in Python

2016-11-25 Thread Ned Batchelder
On Friday, November 25, 2016 at 6:34:00 AM UTC-5, Ned Batchelder wrote: > On Friday, November 25, 2016 at 6:24:47 AM UTC-5, Nikunj wrote: > > Hi All, > > > > Out of curiosity, I wanted to understand the reason behind having different > > memory location for two identical floats . This is unlike i

Re: Immutability of Floats, Ints and Strings in Python

2016-11-25 Thread Ned Batchelder
On Friday, November 25, 2016 at 6:24:47 AM UTC-5, Nikunj wrote: > Hi All, > > Out of curiosity, I wanted to understand the reason behind having different > memory location for two identical floats . This is unlike ints or strings. > Tried googling but couldn't find anything concrete. Any links o

Immutability of Floats, Ints and Strings in Python

2016-11-25 Thread Nikunj
Hi All, Out of curiosity, I wanted to understand the reason behind having different memory location for two identical floats . This is unlike ints or strings. Tried googling but couldn't find anything concrete. Any links or references would be appreciated! Example: For FLOATS: == >>>

Re: array and strings in Python 3

2010-12-11 Thread wander.lairson
> The `array` module's handling of strings changed as well. Reading the > Python 3 docs @ http://docs.python.org/dev/library/array.html , we > find (all emphases added): > class array.array(typecode[, initializer]) >    [...] >    If given a list or string, the initializer is passed to the new > ar

Re: array and strings in Python 3

2010-12-11 Thread Chris Rebert
On Sat, Dec 11, 2010 at 5:32 PM, wander.lairson wrote: > Hello, > > This is my first post on python mailing list. I've working in code > which must run on python 2 and python 3. I am using array.array as > data buffers. I am stuck with the following code line, which works on > Python 2, but not on

array and strings in Python 3

2010-12-11 Thread wander.lairson
Hello, This is my first post on python mailing list. I've working in code which must run on python 2 and python 3. I am using array.array as data buffers. I am stuck with the following code line, which works on Python 2, but not on Python 3.1.2: >>> import array >>> array.array('B', 'test') Trace

Re: Inspecting And Changing Strings In Python

2009-04-29 Thread Duncan Booth
"Jim Carlock" wrote: > Anyone here able to provide a link to the Python functions for > comparing strings and updating strings? I'm looking to do some > character by character analysis until I find the '@' character > and then change the rest of the string after that. > You cannot update a strin

Re: Inspecting And Changing Strings In Python

2009-04-29 Thread Joel Madigan
Start here: http://www.lmgtfy.com/?q=python+string On Wed, Apr 29, 2009 at 10:36 AM, Jim Carlock wrote: > Anyone here able to provide a link to the Python functions for > comparing strings and updating strings? I'm looking to do some > character by character analysis until I find the '@' characte

Inspecting And Changing Strings In Python

2009-04-29 Thread Jim Carlock
Anyone here able to provide a link to the Python functions for comparing strings and updating strings? I'm looking to do some character by character analysis until I find the '@' character and then change the rest of the string after that. Thank you for your help. -- Jim Carlock http://www.micro

Re: Showing native 8-bit strings in Python interpreter

2007-11-08 Thread Diez B. Roggisch
braver wrote: > I'm storing 8-bit characters from the 128-256 range in Python > strings. They are Windows CP1251 Russian characters. When looking at > those strings in the Python interpreter, they come up as codes inside > the string. How can I teach Python to show those 8-bit characters in > t

Showing native 8-bit strings in Python interpreter

2007-11-08 Thread braver
I'm storing 8-bit characters from the 128-256 range in Python strings. They are Windows CP1251 Russian characters. When looking at those strings in the Python interpreter, they come up as codes inside the string. How can I teach Python to show those 8-bit characters in the native encoding of the

Re: Strings in Python

2007-02-09 Thread Johny
Thanks ALL for help and ideas L -- http://mail.python.org/mailman/listinfo/python-list

Re: Strings in Python

2007-02-08 Thread MRAB
On Feb 8, 6:32 pm, [EMAIL PROTECTED] wrote: > On Feb 8, 8:28 am, "Johny" <[EMAIL PROTECTED]> wrote: > > > > > Playing a little more with strings, I found out that string.find > > function provides the position of > > the first occurance of the substring in the string. > > Is there a way how to find

Re: Strings in Python

2007-02-08 Thread attn . steven . kuo
On Feb 8, 8:28 am, "Johny" <[EMAIL PROTECTED]> wrote: > Playing a little more with strings, I found out that string.find > function provides the position of > the first occurance of the substring in the string. > Is there a way how to find out all substring's position ? > To explain more, > let's s

Re: Strings in Python

2007-02-08 Thread Shawn Milo
On 2/8/07, Gary Herron <[EMAIL PROTECTED]> wrote: > Johny wrote: > > Playing a little more with strings, I found out that string.find > > function provides the position of > > the first occurance of the substring in the string. > > Is there a way how to find out all substring's position ? > > To ex

Re: Strings in Python

2007-02-08 Thread Shawn Milo
On 8 Feb 2007 08:28:25 -0800, Johny <[EMAIL PROTECTED]> wrote: > Playing a little more with strings, I found out that string.find > function provides the position of > the first occurance of the substring in the string. > Is there a way how to find out all substring's position ? > To explain more,

Re: Strings in Python

2007-02-08 Thread Gary Herron
Johny wrote: > Playing a little more with strings, I found out that string.find > function provides the position of > the first occurance of the substring in the string. > Is there a way how to find out all substring's position ? > To explain more, > let's suppose > > mystring='12341' > import stri

Strings in Python

2007-02-08 Thread Johny
Playing a little more with strings, I found out that string.find function provides the position of the first occurance of the substring in the string. Is there a way how to find out all substring's position ? To explain more, let's suppose mystring='12341' import string >>> string.find(mystring ,

Re: A bug for unicode strings in Python 2.4?

2006-01-11 Thread Szabolcs Nagy
> Thanks. I'll write my own split(). do you want to split character by character? then use list(u'\u9019\u662f\u4e2d\u6587\u5b57\u4e32') -- http://mail.python.org/mailman/listinfo/python-list

Re: A bug for unicode strings in Python 2.4?

2006-01-10 Thread Thomas Moore
Hi: Thanks. I'll write my own split(). Frank -- http://mail.python.org/mailman/listinfo/python-list

Re: A bug for unicode strings in Python 2.4?

2006-01-10 Thread Fredrik Lundh
Thomas Moore wrote: > Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on > win32 > Type "help", "copyright", "credits" or "license" for more information. > >>> u=u'\u9019\u662f\u4e2d\u6587\u5b57\u4e32' > >>> u.split() > [u'\u9019\u662f\u4e2d\u6587\u5b57\u4e32'] > >>> > > I th

Re: A bug for unicode strings in Python 2.4?

2006-01-10 Thread Thomas Moore
> Thomas Moore: > > u=u'\u9019\u662f\u4e2d\u6587\u5b57\u4e32' > u.split() > > > > [u'\u9019\u662f\u4e2d\u6587\u5b57\u4e32'] > > > > > > I think u should get split. > > Where do you think "這是中文字串" should be split and why? Isn't a unicode string character by character? -Frank -- http

Re: A bug for unicode strings in Python 2.4?

2006-01-10 Thread Neil Hodgson
Thomas Moore: u=u'\u9019\u662f\u4e2d\u6587\u5b57\u4e32' u.split() > > [u'\u9019\u662f\u4e2d\u6587\u5b57\u4e32'] > > > I think u should get split. Where do you think "這是中文字串" should be split and why? Neil -- http://mail.python.org/mailman/listinfo/python-list

A bug for unicode strings in Python 2.4?

2006-01-10 Thread Thomas Moore
Hi: Python 2.4.1 (#65, Mar 30 2005, 09:13:57) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> u=u'\u9019\u662f\u4e2d\u6587\u5b57\u4e32' >>> u.split() [u'\u9019\u662f\u4e2d\u6587\u5b57\u4e32'] >>> I think u should get split. --Frank

Re: Is there no compression support for large sized strings in Python?

2005-12-05 Thread Christopher Subich
Fredrik Lundh wrote: > Christopher Subich wrote: >> >>I have access to an itanium system with a metric ton of memory. I >>-think- that the Python version is still only a 32-bit python > > > an ILP64 system is a system where int, long, and pointer are all 64 bits, > so a 32-bit python on a 64-bi

Re: Is there no compression support for large sized strings in Python?

2005-12-03 Thread Fredrik Lundh
Christopher Subich wrote: >> anyone out there with an ILP64 system? > > I have access to an itanium system with a metric ton of memory. I > -think- that the Python version is still only a 32-bit python an ILP64 system is a system where int, long, and pointer are all 64 bits, so a 32-bit python o

Re: Is there no compression support for large sized strings in Python?

2005-12-02 Thread Christopher Subich
Fredrik Lundh wrote: > Harald Karner wrote: >>>python -c "print len('m' * ((2048*1024*1024)-1))" >> >>2147483647 > > > the string type uses the ob_size field to hold the string length, and > ob_size is an integer: > > $ more Include/object.h > ... > int ob_size; /* Number of items in va

Re: Is there no compression support for large sized strings in Python?

2005-12-02 Thread Claudio Grondi
"Gerald Klix" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > Did you consider the mmap library? > Perhaps it is possible to avoid to hold these big stings in memory. > BTW: AFAIK it is not possible in 32bit windows for an ordinary programm > to allocate more than 2 GB. That re

Re: Is there no compression support for large sized strings in Python?

2005-12-01 Thread Alex Martelli
Claudio Grondi <[EMAIL PROTECTED]> wrote: ... > In this context I am very curious how many of such > 2 GByte strings is it possible to create within a > single Python process? VM (Virtual Memory) may make the issue difficult to answer precisely. With a Python build for 64-bit addressing (and r

Re: Is there no compression support for large sized strings in Python?

2005-12-01 Thread Claudio Grondi
"Harald Karner" <[EMAIL PROTECTED]> schrieb im Newsbeitrag news:[EMAIL PROTECTED] > Claudio Grondi wrote: > > Anyone on a big Linux machine able to do e.g. : > > \>python -c "print len('m' * 2500*1024*1024)" > > or even more without a memory error? > > I tried on a Sun with 16GB Ram (Python 2.3.

Re: Is there no compression support for large sized strings in Python?

2005-12-01 Thread Fredrik Lundh
Harald Karner wrote: > I tried on a Sun with 16GB Ram (Python 2.3.2) > seems like 2GB is the limit for string size: > > > python -c "print len('m' * 2048*1024*1024)" > Traceback (most recent call last): > File "", line 1, in ? > OverflowError: repeated string is too long > > > python -c "print l

Re: Is there no compression support for large sized strings in Python?

2005-12-01 Thread Harald Karner
Claudio Grondi wrote: > Anyone on a big Linux machine able to do e.g. : > \>python -c "print len('m' * 2500*1024*1024)" > or even more without a memory error? I tried on a Sun with 16GB Ram (Python 2.3.2) seems like 2GB is the limit for string size: > python -c "print len('m' * 2048*1024*1024)

Re: Is there no compression support for large sized strings in Python?

2005-12-01 Thread Claudio Grondi
I was also able to create a 1GB string on a different system (Linux 2.4.x, 32-bit Dual Intel Xeon, 8GB RAM, python 2.2). $ python -c 'print len("m" * 1024*1024*1024)' 1073741824 I agree with another poster that you may be hitting Windows limitations rather than Python ones, but I am certainly not f

Re: Is there no compression support for large sized strings in Python?

2005-12-01 Thread Fredrik Lundh
Christophe wrote: > > Did you consider the mmap library? > > Perhaps it is possible to avoid to hold these big stings in memory. > > BTW: AFAIK it is not possible in 32bit windows for an ordinary programm > > to allocate more than 2 GB. That restriction comes from the jurrasic > > MIPS-Processors,

Re: Is there no compression support for large sized strings in Python?

2005-12-01 Thread Christophe
Gerald Klix a écrit : > Did you consider the mmap library? > Perhaps it is possible to avoid to hold these big stings in memory. > BTW: AFAIK it is not possible in 32bit windows for an ordinary programm > to allocate more than 2 GB. That restriction comes from the jurrasic > MIPS-Processors, that

Re: Is there no compression support for large sized strings in Python?

2005-12-01 Thread Gerald Klix
time >>> bz2 fails to compress running endlessly consuming 99% of CPU time >>> >>>The same works with a 10 MByte string without any problem. >>> >>>So what? Is there no compression support for large sized strings in > > Python? > >>you'r

Re: Is there no compression support for large sized strings in Python?

2005-12-01 Thread Claudio Grondi
gt; > > > At least on my system: > > zlib fails to decompress raising a memory error > > pylzma fails to decompress running endlessly consuming 99% of CPU time > > bz2 fails to compress running endlessly consuming 99% of CPU time > > > > The same works with a 1

Re: Is there no compression support for large sized strings in Python?

2005-12-01 Thread jepler
On this system (Linux 2.6.x, AMD64, 2 GB RAM, python2.4) I am able to construct a 1 GB string by repetition, as well as compress a 512MB string with gzip in one gulp. $ cat claudio.py s = '1234567890'*(1048576*50) import zlib c = zlib.compress(s) print len(c) open("/tmp/c

Re: Is there no compression support for large sized strings in Python?

2005-12-01 Thread Fredrik Lundh
U time > bz2 fails to compress running endlessly consuming 99% of CPU time > > The same works with a 10 MByte string without any problem. > > So what? Is there no compression support for large sized strings in Python? you're probably measuring windows' memory managment rath

Is there no compression support for large sized strings in Python?

2005-12-01 Thread Claudio Grondi
works with a 10 MByte string without any problem. So what? Is there no compression support for large sized strings in Python? Am I doing something the wrong way here? Is there any and if yes, what is the theoretical upper limit of string size which can be processed by each of the compression