AW: [Python-de] Aus r'\012' einen Zeilenumbruch ohne if erzeugen
Martin Möllenbeck
Martin.Moellenbeck at t-online.de
Mon Feb 10 20:07:06 EST 2003
Hallo Georg,
zu beachten bei dem Problem:
>>> r'\012' == '\012'
0
>>>
hier handelt es sich eine Raw-String und eine bei dem die
"Sonderzeichen"
evaluiert werden.
Gruss
Martin
-----Ursprüngliche Nachricht-----
Von: python-de-admin at python.net [mailto:python-de-admin at python.net] Im
Auftrag von Georg Mischler
Gesendet: Montag, 10. Februar 2003 20:01
An: python-de at python.net
Betreff: Re: [Python-de] Aus r'\012' einen Zeilenumbruch ohne if
erzeugen
Fritz Cizmarov wrote:
> >>> erg.replace(r'\012', '\n')
Ich hoffe, das ist ein Scherz?
>>> '\n' is '\012'
1
>>> '\n' == '\012'
1
>>> '\n'
'\n'
>>> '\012'
'\n'
>>> print '\n'
>>> print '\012'
>>>
Das \012 ist schlicht die numerische Repraesentation des
<newline> characters, also mit '\n' identisch.
Ehrlich gesagt verstehe ich deswegen weder das urspruengliche
Problem noch die vermeintliche Loesung so ganz...
-schorsch
--
Georg Mischler -- simulations developer -- schorsch at schorsch com
+schorsch.com+ -- lighting design tools -- http://www.schorsch.com/
_______________________________________________
Python-de maillist - Python-de at starship.python.net
http://starship.python.net/mailman/listinfo/python-de
More information about the Python-de
mailing list