On Wednesday, August 28, 2013 12:23:12 PM UTC+2, Dave Angel wrote:
> On 28/8/2013 04:01, Kurt Mueller wrote:
> > Because I cannot switch to Python 3 for now my life is not so easy:-)
> > For some text manipulation tasks I need a template to split lines
> > from stdin into a list of strings the way
On 28/8/2013 04:01, Kurt Mueller wrote:
> Because I cannot switch to Python 3 for now my life is not so easy:-)
>
> For some text manipulation tasks I need a template to split lines
> from stdin into a list of strings the way shlex.split() does it.
> The encoding of the input can vary.
> For furt
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
iso-8859-1?
>>> You have to know the actual encodi
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
iso-8859-1?
>>> You have to know the actual encodi
On Thu, 08 Aug 2013 17:24:49 +0200, Kurt Mueller wrote:
> What do I do, when input_strings/output_list has other codings like
> iso-8859-1?
When reading from a text file, honour some sort of encoding cookie at the
top (or bottom) of the file, like Emacs and Vim use, or a BOM. If there
is no enc
Le jeudi 8 août 2013 18:27:06 UTC+2, Kurt Mueller a écrit :
> Now I have this small example:
>
> --
>
> #!/usr/bin/env python
>
> # vim: set fileencoding=utf-8 :
>
>
>
> from __future__ import print_function
>
> import sys, shlex
>
>
On 8/8/2013 11:24 AM, Kurt Mueller wrote:
print( u'{0:>3} {1:>3} {2:>3} {3:>3} {4:>3}'.format( *output_list ) )
Using autonumbering feature, same as
print( u'{:>3} {:>3} {:>3} {:>3} {:>3}'.format( *output_list ) )
print( (u' '.join([u'{:>3}']*5)).format(*output_list) )
print( (u' '.join([u'{:
Kurt Mueller wrote:
> Now I have this small example:
> --
> #!/usr/bin/env python
> # vim: set fileencoding=utf-8 :
>
> from __future__ import print_function
> import sys, shlex
>
> print( repr( sys.stdin.encoding ) )
>
> strg_form = u'{0:>3}
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
>>> iso-8859-1?
>>
>> You have to know the actual encoding. With that information it's easy:
> output_l
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
>>> iso-8859-1?
>>
>> You have to know the actual encoding. With that information it's easy:
> output_list
>> ['\xc3\xb6', '\xc3\xbc',
Now I have this small example:
--
#!/usr/bin/env python
# vim: set fileencoding=utf-8 :
from __future__ import print_function
import sys, shlex
print( repr( sys.stdin.encoding ) )
strg_form = u'{0:>3} {1:>3} {2:>3} {3:>3} {4:>3}'
for inpt_l
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\xb6', '\xc3\xbc', 'i', 's', 'f']
encoding
Kurt Mueller wrote:
> 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
>> print( u'>{0:>3}<'.format( u'ä' ) )
>> W
Kurt Mueller wrote:
> 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
>> print( u'>{0:>3}<'.format( u'ä' ) )
>> W
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
> print( u'>{0:>3}<'.format( u'ä' ) )
> Why not use rjust for it though
On 08/08/2013 15:40, Neil Cerutti wrote:
On 2013-08-08, Kurt Mueller wrote:
I'd like to print strings right adjusted.
( Python 2.7.3, Linux 3.4.47-2.38-desktop )
from __future__ import print_function
print( '>{0:>3}<'.format( 'a' ) )
a<
But if the string contains an Umlaut:
print( '>{0:>3}
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
print( u'>{0:>3}<'.format( u'ä' ) )
Why not use rjust for it though?
u'ä'.rjust(3)
--
Jonathan
--
http://mail.python
On 2013-08-08, Kurt Mueller wrote:
> I'd like to print strings right adjusted.
> ( Python 2.7.3, Linux 3.4.47-2.38-desktop )
>
> from __future__ import print_function
> print( '>{0:>3}<'.format( 'a' ) )
>> a<
>
> But if the string contains an Umlaut:
> print( '>{0:>3}<'.format( '??' ) )
>> ??<
>
I'd like to print strings right adjusted.
( Python 2.7.3, Linux 3.4.47-2.38-desktop )
from __future__ import print_function
print( '>{0:>3}<'.format( 'a' ) )
> a<
But if the string contains an Umlaut:
print( '>{0:>3}<'.format( 'ä' ) )
> ä<
Same with % notation:
print( '>%3s<' % ( 'a' ) )
> a<
2011/5/13 MRAB :
> The latest release is here:
>
> http://pypi.python.org/pypi/regex
> --
Wow, set operators were added recently ...
https://code.google.com/p/mrab-regex-hg/wiki/GeneralDetails
ok, it might be not necassary to sove this exact problem with respect
to the solutions already mentione
will grab your desired umlauts.
I'd actually recommend, however, that if you have an extra 20 minutes,
to use Regexp 2.7:
http://bugs.python.org/issue2636
Its a much needed improvement over F.Lundh's re implementation (from
1999!) and its 40% faster. Moreover, you can do exactly wh
On 2011-05-13, Peter Otten wrote:
> Jens Lechtenboerger wrote:
>
>> I'm looking for a regular expression to recognize natural language
>> words with umlauts but without numbers. While \w with re.U does
>> recognize words with umlauts, it also matches numbers, whic
Jens Lechtenboerger wrote:
> I'm looking for a regular expression to recognize natural language
> words with umlauts but without numbers. While \w with re.U does
> recognize words with umlauts, it also matches numbers, which I do
> not want.
>
> Is there a better
Hallo Jens,
In current python re module, you have to do something like:
((?!\d|_\w)+ which uses the negative look ahead to grab all words except
integers and underscore. Of course, if you turn on the unicode flag re.U or
use it inline like, (?u) then this will grab your desired umlauts.
I
Dear experts,
I'm looking for a regular expression to recognize natural language
words with umlauts but without numbers. While \w with re.U does
recognize words with umlauts, it also matches numbers, which I do
not want.
Is there a better way than an exhaustive enumeration such as
[-a-zàá
equence for ö in utf-8.
If this shows something else, you need to adjust your terminal settings.
for me it also prints the correct o-umlaut (ö), so that was not the
problem.
All of the below result in xml that shows all umlauts correctly when
printed:
xml.decode("cp1252")
xml.
this shows something else, you need to adjust your terminal settings.
for me it also prints the correct o-umlaut (ö), so that was not the problem.
All of the below result in xml that shows all umlauts correctly when printed:
xml.decode("cp1252")
xml.decode("cp1252"
The server is sniffing the User-Agent header to decide whether to
send UTF-8 or ISO-8859-1. Try this code:
import urllib2
r = urllib2.Request("http://www.google.de/ig/api?weather=Muenchen";,
None, {"User-Agent":"Mozilla/5.0"})
f = urllib2.urlopen(r)
i = f.info()
print(i)
xml = f.read()
This is wierd. I looked at the site in FireFox - and it was
> >displayed correctly, including umlauts. Bringing up the
> >info-dialog claims the page is UTF-8, the XML itself says so as
> >well (implicit, through the missing declaration of an encoding) -
> >but it clearly is *n
"Diez B. Roggisch" wrote in message
news:7jub5rf37div...@mid.uni-berlin.de...
[snip]
This is wierd. I looked at the site in FireFox - and it was displayed
correctly, including umlauts. Bringing up the info-dialog claims the page
is UTF-8, the XML itself says so as well (implici
On Sat, 17 Oct 2009 21:24:59 +0330, Arian Kuschki wrote:
> I just checked and I see the following in the headers: Content-Type
> text/xml; charset=UTF-8
>
> Where does it say ISO-8859-1?
In the headers returned via urllib (and via wget). But checking in
Firefox, it does indeed specify UTF-8 in t
as displayed
> > correctly, including umlauts. Bringing up the info-dialog claims the
> > page is UTF-8, the XML itself says so as well (implicit, through the
> > missing declaration of an encoding) - but it clearly is *not* utf-8.
>
> The headers correctly identify i
n utf-8.
>
>If this shows something else, you need to adjust your terminal settings.
for me it also prints the correct o-umlaut (ö), so that was not the problem.
All of the below result in xml that shows all umlauts correctly when printed:
xml.decode("cp1252")
xml.decode("c
On Sat, 17 Oct 2009 18:54:10 +0200, Diez B. Roggisch wrote:
> This is wierd. I looked at the site in FireFox - and it was displayed
> correctly, including umlauts. Bringing up the info-dialog claims the
> page is UTF-8, the XML itself says so as well (implicit, through the
> missing
t
contains umlauts. Consider the following:
In [1]: import urllib
In [2]: f = urllib.urlopen("http://www.google.de/ig/api?weather=Muenchen";)
In [3]: xml = f.read()
In [4]: f.close()
In [5]: print xml
--> print(xml)
As you can see the umlauts in the XML are not displayed properly.
what to do. I always have problems when dealing input text that
> >> contains umlauts. Consider the following:
>
> >> In [1]: import urllib
>
> >> In [2]: f = urllib.urlopen("http://www.google.de/ig/api?weather=Muenchen";)
>
> >> In [3]: xml
On 10月18日, 上午12时14分, MRAB wrote:
> Arian Kuschki wrote:
> > Hi all
>
> > this has been bugging me for a long time and I do not seem to be able to
> > understand what to do. I always have problems when dealing input text that
> > contains umlauts. Consider the f
MRAB schrieb:
Arian Kuschki wrote:
Hi all
this has been bugging me for a long time and I do not seem to be able
to understand what to do. I always have problems when dealing input
text that contains umlauts. Consider the following:
In [1]: import urllib
In [2]: f =
urllib.urlopen("
MRAB schrieb:
Arian Kuschki wrote:
Hi all
this has been bugging me for a long time and I do not seem to be able
to understand what to do. I always have problems when dealing input
text that contains umlauts. Consider the following:
In [1]: import urllib
In [2]: f =
urllib.urlopen("
StarWing schrieb:
On 10月17日, 下午9时54分, Arian Kuschki
wrote:
Hi all
this has been bugging me for a long time and I do not seem to be able to
understand what to do. I always have problems when dealing input text that
contains umlauts. Consider the following:
In [1]: import urllib
In [2]: f
StarWing schrieb:
On 10月17日, 下午9时54分, Arian Kuschki
wrote:
Hi all
this has been bugging me for a long time and I do not seem to be able to
understand what to do. I always have problems when dealing input text that
contains umlauts. Consider the following:
In [1]: import urllib
In [2]: f
On 10月17日, 下午9时54分, Arian Kuschki
wrote:
> Hi all
>
> this has been bugging me for a long time and I do not seem to be able to
> understand what to do. I always have problems when dealing input text that
> contains umlauts. Consider the following:
>
> In [1]: import
Arian Kuschki wrote:
Hi all
this has been bugging me for a long time and I do not seem to be able to
understand what to do. I always have problems when dealing input text that
contains umlauts. Consider the following:
In [1]: import urllib
In [2]: f = urllib.urlopen("http://www.goog
Arian Kuschki schrieb:
Hi all
this has been bugging me for a long time and I do not seem to be able to
understand what to do. I always have problems when dealing input text that
contains umlauts. Consider the following:
In [1]: import urllib
In [2]: f = urllib.urlopen("http://www.goog
Hi all
this has been bugging me for a long time and I do not seem to be able to
understand what to do. I always have problems when dealing input text that
contains umlauts. Consider the following:
In [1]: import urllib
In [2]: f = urllib.urlopen("http://www.google.de/ig/api?weather=Mue
gt; or encode the text before writing:
>
> text = text.encode("latin1")
>
> (I'm assuming you want the output file to be in Latin1.)
>
> >
> >> Claus Hausberger wrote:
> >>
> >>> I have a text file with is encoding in
s encoding in Latin1 (ISO-8859-1). I can't
change that as I do not create those files myself. I have to read
those files and convert the umlauts like ö to stuff like &oumol; as
the text files should become html files.
umlaut-in.txt:
This file is contains data in the unicode
character
ate those files myself. I have to read
> > those files and convert the umlauts like ö to stuff like &oumol; as
> > the text files should become html files.
>
> umlaut-in.txt:
>
> This file is contains data in the unicode
> character set and is encoded with utf-8.
>
Michiel Overtoom schrob:
> Viele Röhre. Macht spaß! Tsüsch!
LOL! :)
Stefan
--
http://mail.python.org/mailman/listinfo/python-list
Claus Hausberger wrote:
I have a text file with is encoding in Latin1 (ISO-8859-1). I can't
change that as I do not create those files myself. I have to read
those files and convert the umlauts like ö to stuff like &oumol; as
the text files should become html files.
umlaut-in.txt:
Claus Hausberger wrote:
> Hello
>
> I have a text file with is encoding in Latin1 (ISO-8859-1). I can't change
> that as I do not create those files myself.
>
> I have to read those files and convert the umlauts like ö to stuff like
> &oumol; as the text files sh
Hello
I have a text file with is encoding in Latin1 (ISO-8859-1). I can't change that
as I do not create those files myself.
I have to read those files and convert the umlauts like ö to stuff like &oumol;
as the text files should become html files.
I have this code:
#!/usr/b
On Sat, 13 Dec 2008 02:58:48 -0800, a_olme wrote:
> On 13 Dec, 10:38, "Martin v. Löwis" wrote:
>> > When I try to use umlauts in idle it will only print out as Unicode
>> > escape characters. Is it possible to configure idle to print them as
>> > ordinary
On 13 Dec, 10:38, "Martin v. Löwis" wrote:
> > When I try to use umlauts in idle it will only print out as Unicode
> > escape characters. Is it possible to configure idle to print them as
> > ordinary characters?
>
> Did you really use the print statement? They
> When I try to use umlauts in idle it will only print out as Unicode
> escape characters. Is it possible to configure idle to print them as
> ordinary characters?
Did you really use the print statement? They print out fine for me.
Regards,
Martin
--
http://mail.python.org/mailman
On Fri, Dec 12, 2008 at 3:51 PM, a_olme wrote:
> Hello all,
>
> When I try to use umlauts in idle it will only print out as Unicode
> escape characters. Is it possible to configure idle to print them as
> ordinary characters?
> Best Regards Anders Olme
Make sure you
Hello all,
When I try to use umlauts in idle it will only print out as Unicode
escape characters. Is it possible to configure idle to print them as
ordinary characters?
Best Regards Anders Olme
--
http://mail.python.org/mailman/listinfo/python-list
Nico Grubert wrote:
> + On a solaris machine running thunderbird 1.5.0.8 and on a macintosh
> machine running eudora umlauts are *not* displayed properly.
> The email header does not contain any "Content-type". If I manually
> switch the email client's character
Hi there,
I wrote a short python script that sends an email using python's email
module and I am using Python 2.3.5.
The problem is, that umlauts are not displayed properly in some email
clients:
+ On a windows machine running thunderbird 1.0.2 umlauts are displayed
properly.
The
59 matches
Mail list logo