Re: how to detect the character encoding in a web page ?

2012-12-24 Thread Kurt Mueller
Am 24.12.2012 um 04:03 schrieb iMath: > but how to let python do it for you ? > such as these 2 pages > http://python.org/ > http://msdn.microsoft.com/en-us/library/bb802962(v=office.12).aspx > how to detect the character encoding in these 2 pages by python ? If you have the html code, let

Re: Donald E. Knuth in Python, cont'd

2012-04-11 Thread Kurt Mueller
Am 11.04.2012 16:38, schrieb mwil...@the-wire.com: Antti J Ylikoski wrote: I wrote about a straightforward way to program D. E. Knuth in Python, Maybe it's godly coded... $ python Easter.py The year: 2012 (20, 'th ', 'APRIL, ', 2012) $ AFAIK it was the 8th of April 2012? Grüessli -- Kurt

right adjusted strings containing umlauts

2013-08-08 Thread Kurt Mueller
#x27; ) ) > ä< Same with % notation: print( '>%3s<' % ( 'a' ) ) > a< print( '>%3s<' % ( 'ä' ) ) > ä< For a string with no Umlaut it uses 3 characters, but for an Umlaut it uses only 2 characters. I guess it has to to with unicode. How do I get it right? TIA -- Kurt Mueller -- http://mail.python.org/mailman/listinfo/python-list

Re: right adjusted strings containing umlauts

2013-08-08 Thread Kurt Mueller
Am 08.08.2013 16:43, schrieb jfhar...@gmail.com: > On Thursday, 8 August 2013 15:23:46 UTC+1, Kurt Mueller wrote: >> I'd like to print strings right adjusted. >> print( '>{0:>3}<'.format( 'ä' ) ) > > Make both strings unicode > prin

Re: right adjusted strings containing umlauts

2013-08-08 Thread Kurt Mueller
Am 08.08.2013 17:44, schrieb Peter Otten: > Kurt Mueller wrote: >> What do I do, when input_strings/output_list has other codings like >> iso-8859-1? > > You have to know the actual encoding. With that information it's easy: >>>> output_list > ['\xc3\

Re: right adjusted strings containing umlauts

2013-08-08 Thread Kurt Mueller
encodings/utf_8.py", line 16, in decode return codecs.utf_8_decode(input, errors, True) UnicodeDecodeError: 'utf8' codec can't decode byte 0xf6 in position 0: invalid start byte muk@mcp20:/sw/prog/scripts/text_manip> How do I handle this two inputs? TIA -- Kurt Mueller -- http://mail.python.org/mailman/listinfo/python-list

Re: right adjusted strings containing umlauts

2013-08-23 Thread Kurt Mueller
Am 08.08.2013 18:37, schrieb Chris Angelico: > On Thu, Aug 8, 2013 at 5:16 PM, Kurt Mueller > wrote: >> Am 08.08.2013 17:44, schrieb Peter Otten: >>> Kurt Mueller wrote: >>>> What do I do, when input_strings/output_list has other codings like >>>>

Re: right adjusted strings containing umlauts

2013-08-28 Thread Kurt Mueller
Am 08.08.2013 18:37, schrieb Chris Angelico: > On Thu, Aug 8, 2013 at 5:16 PM, Kurt Mueller > wrote: >> Am 08.08.2013 17:44, schrieb Peter Otten: >>> Kurt Mueller wrote: >>>> What do I do, when input_strings/output_list has other codings like >>>>

split lines from stdin into a list of unicode strings

2013-08-28 Thread Kurt Mueller
###### $ cat | template.py Comments are welcome. TIA -- Kurt Mueller -- http://mail.python.org/mailman/listinfo/python-list

Re: split lines from stdin into a list of unicode strings

2013-08-29 Thread Kurt Mueller
Am 29.08.2013 11:12, schrieb Peter Otten: > kurt.alfred.muel...@gmail.com wrote: >> On Wednesday, August 28, 2013 1:13:36 PM UTC+2, Dave Angel wrote: >>> On 28/8/2013 04:32, Kurt Mueller wrote: >>>> For some text manipulation tasks I need a template to split lines

Re: split lines from stdin into a list of unicode strings

2013-09-05 Thread Kurt Mueller
Am 29.08.2013 11:12, schrieb Peter Otten: > kurt.alfred.muel...@gmail.com wrote: >> On Wednesday, August 28, 2013 1:13:36 PM UTC+2, Dave Angel wrote: >>> On 28/8/2013 04:32, Kurt Mueller wrote: >>>> For some text manipulation tasks I need a template to split lines

Re: split lines from stdin into a list of unicode strings

2013-09-05 Thread Kurt Mueller
Am 05.09.2013 10:33, schrieb Peter Otten: > Kurt Mueller wrote: >> Am 29.08.2013 11:12, schrieb Peter Otten: >>> kurt.alfred.muel...@gmail.com wrote: >>>> On Wednesday, August 28, 2013 1:13:36 PM UTC+2, Dave Angel wrote: >>>>> On 28/8/2013 04

Re: How to turn a string into a list of integers?

2014-09-05 Thread Kurt Mueller
196] My obviously wrong understanding: ‚AÄ‘ in ‚ascii‘ are two characters one with ord A=65 and one with ord Ä=196 ISO8859-1 —-> why [65, 195, 132] u’AÄ’ is an Unicode string —-> why [65, 196] It is just the other way round as I would expect. Thank you -- Kurt Mueller, kurt.alfred.muel...@gmail.com -- https://mail.python.org/mailman/listinfo/python-list

Re: How to turn a string into a list of integers?

2014-09-05 Thread Kurt Mueller
Am 05.09.2014 um 20:25 schrieb Chris “Kwpolska” Warrick : > On Sep 5, 2014 7:57 PM, "Kurt Mueller" wrote: > > Could someone please explain the following behavior to me: > > Python 2.7.7, MacOS 10.9 Mavericks > > > > >>> import sys > > >>

Re: How to turn a string into a list of integers?

2014-09-05 Thread Kurt Mueller
Am 05.09.2014 um 21:16 schrieb Kurt Mueller : > Am 05.09.2014 um 20:25 schrieb Chris “Kwpolska” Warrick : >> On Sep 5, 2014 7:57 PM, "Kurt Mueller" wrote: >>> Could someone please explain the following behavior to me: >>> Python 2.7.7, MacOS

Re: How to turn a string into a list of integers?

2014-09-06 Thread Kurt Mueller
Am 06.09.2014 um 07:47 schrieb Steven D'Aprano : > Kurt Mueller wrote: >> Could someone please explain the following behavior to me: >> Python 2.7.7, MacOS 10.9 Mavericks [snip] Thanks for the detailed explanation. I think I understand a bit better now. Now the part of the

Re: How to turn a string into a list of integers?

2014-09-06 Thread Kurt Mueller
Am 06.09.2014 um 20:19 schrieb Steven D'Aprano : > Kurt Mueller wrote: > [...] >> Now the part of the two Python builds is still somewhat unclear to me. > [...] >> In Python 2.7: >> As I learned from the ord() manual: >> If a unicode argument is given

Minor Typo in doc

2008-12-18 Thread Kurt Mueller
Hi There is a minor typo in the new doc in: http://www.python.org/doc/2.6/library/signal.html -- signal.SIG_DFL¶ This is one of two standard signal handling options; it will simply perform the default function for the signa

Re: Minor Typo in doc

2008-12-19 Thread Kurt Mueller
Steve Holden schrieb: > Kurt Mueller wrote: >> Hi >> There is a minor typo in the new doc in: >> http://www.python.org/doc/2.6/library/signal.html >> -- >> signal.SIG_DFL¶ >> This is one of two

Re: HARD REAL TIME PYTHON

2008-10-07 Thread Kurt Mueller
Am 07.10.2008 um 11:44 schrieb Diez B. Roggisch: Kurt Mueller wrote: David, As others mentioned before, python is not the right tool for "HARD REAL TIME". But: Maybe you can isolate the part of your application that needs "HARD REAL TIME". Then implement this p

Re: HARD REAL TIME PYTHON

2008-10-07 Thread Kurt Mueller
David, Am 07.10.2008 um 01:25 schrieb Blubaugh, David A.: I have done some additional research into the possibility of utilizing Python for hard real time development. I have seen on various websites where this has been discussed before on the internet. However, I was wondering as to how s

Re: HARD REAL TIME PYTHON

2008-10-07 Thread Kurt Mueller
Am 08.10.2008 um 06:59 schrieb Hendrik van Rooyen: "Blubaugh, David A." wrote: I have done some additional research into the possibility of utilizing Python for hard real time development. I have seen on various websites where this has been discussed before on the internet. However, I was

string processing question

2009-04-30 Thread Kurt Mueller
Hi, on a Linux system and python 2.5.1 I have the following behaviour which I do not understand: case 1 > python -c 'a="ä"; print a ; print a.center(6,"-") ; b=unicode(a, "utf8"); > print b.center(6,"-")' ä --ä-- --ä--- > case 2 - an UnicodeEncodeError in this case: > python -c 'a="ä";

Re: string processing question

2009-05-01 Thread Kurt Mueller
program or to a file. Maybe we leave the other issue with the different centering for the moment. My goal is to have my python programs unicode enabled. TIA -- Kurt Mueller -- Kurt Müller, m...@problemlos.ch -- http://mail.python.org/mailman/listinfo/python-list

Re: string processing question

2009-05-01 Thread Kurt Mueller
Scott David Daniels schrieb: > To discover what is happening, try something like: > python -c 'for a in "ä", unicode("ä"): print len(a), a' > > I suspect that in your encoding, "ä" is two bytes long, and in > unicode it is converted to to a single character. :> python -c 'for a in "ä", unicode

Re: string processing question

2009-05-01 Thread Kurt Mueller
Sion Arrowsmith wrote: > Kurt Mueller wrote: >> :> python -c 'print unicode("ä", "utf8")' >> ä >> :> python -c 'print unicode("ä", "utf8")' | cat >> Traceback (most recent call last): >> File "

String split with " and/or ' and/or \

2008-06-24 Thread Kurt Mueller
How to (super)split a string (literal) containing " and/or ' and/or \. example: ' a " b b " c\ c '.supersplit(' ') -> ['a', ' b b ', 'c c'] Thanks and Grüessli -- Kurt Müller: [EMAIL PROTECTED] -- http://mail.python.org/mailman/listinfo/python-list

Re: String split with " and/or ' and/or \

2008-06-24 Thread Kurt Mueller
Peter Otten schrieb: Kurt Mueller wrote: How to (super)split a string (literal) containing " and/or ' and/or \. example: ' a " b b " c\ c '.supersplit(' ') -> ['a', ' b b ', 'c c'] import shlex shlex.split(

Re: Getting pid of a remote process

2008-08-19 Thread Kurt Mueller
srinivasan srinivas schrieb: Thanks a lot. But i am wondeing will it return correct pid if more than one instance of run on the remote machine?? Thanks, Srini On UNIX-like OS: If you start the process in the background, you can get the PID with: :~> ssh 'ls -l & echo PID=$!' | grep PID PI

Re: Glob in python which supports the ** wildcard

2010-11-22 Thread Kurt Mueller
HI, Am 22.11.2010 um 23:05 schrieb Stefan Sonnenberg-Carstens: > Am 22.11.2010 22:43, schrieb Martin Lundberg; >> >> I want to be able to let the user enter paths like this: >> apps/name/**/*.js >> and then find all the matching files in apps/name and all its >> subdirectories. However I found o

Re: Glob in python which supports the ** wildcard

2010-11-22 Thread Kurt Mueller
Hi, Am 22.11.2010 um 23:05 schrieb Stefan Sonnenberg-Carstens: > Am 22.11.2010 22:43, schrieb Martin Lundberg: >> I want to be able to let the user enter paths like this: >> apps/name/**/*.js >> and then find all the matching files in apps/name and all its >> subdirectories. However I found out t

Re: while True or while 1

2010-12-14 Thread Kurt Mueller
is true? Having said this he went out again to the Jews and said to them, I see no wrong in him." Today: We are so thankful that today we are free to define "True" ourselves using Python 2.x. Future: Be warned, the future gets darker! ;-) Grüessli -- Kurt Mueller -- http://mail.python.org/mailman/listinfo/python-list

Re: An assessment of the Unicode standard

2009-09-01 Thread Kurt Mueller
Am 01.09.2009 um 09:39 schrieb Terry Reedy: But this same problem also extends into monies, nation states, units of measure, etc. There is, of course, an international system of measure. The US is the only major holdout. (I recall Burma, or somesuch, is another.) An interesting proposition