Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #52198
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <kurt.alfred.mueller@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.091 |
| X-Spam-Evidence | '*H*': 0.82; '*S*': 0.01; 'string': 0.09; 'python': 0.11; 'kurt': 0.12; '__future__': 0.16; 'unicode.': 0.16; 'import': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'linux': 0.33; 'guess': 0.33; "i'd": 0.34; 'but': 0.35; 'right?': 0.36; 'message-id:@gmail.com': 0.38; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'how': 0.40; 'header:Reply-To:1': 0.67; 'reply-to:no real name:2**0': 0.71; 'reply- to:addr:gmail.com': 0.80; 'characters,': 0.84 |
| X-Virus-Scanned | amavisd-new at aerodynamics.ch |
| Date | Thu, 08 Aug 2013 16:23:46 +0200 |
| From | Kurt Mueller <kurt.alfred.mueller@gmail.com> |
| Organization | Rothenburg |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | right adjusted strings containing umlauts |
| Content-Type | text/plain; charset=UTF-8 |
| Content-Transfer-Encoding | quoted-printable |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| Reply-To | kurt.alfred.mueller@gmail.com |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.352.1375972418.1251.python-list@python.org> (permalink) |
| Lines | 28 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1375972418 news.xs4all.nl 15986 [2001:888:2000:d::a6]:32983 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:52198 |
Show key headers only | View raw
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<
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
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
right adjusted strings containing umlauts Kurt Mueller <kurt.alfred.mueller@gmail.com> - 2013-08-08 16:23 +0200
Re: right adjusted strings containing umlauts Neil Cerutti <neilc@norwich.edu> - 2013-08-08 14:40 +0000
Re: right adjusted strings containing umlauts MRAB <python@mrabarnett.plus.com> - 2013-08-08 16:19 +0100
Re: right adjusted strings containing umlauts jfharden@gmail.com - 2013-08-08 07:43 -0700
Re: right adjusted strings containing umlauts Kurt Mueller <kurt.alfred.mueller@gmail.com> - 2013-08-08 17:24 +0200
Re: right adjusted strings containing umlauts Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-08-10 01:29 +0000
Re: right adjusted strings containing umlauts Peter Otten <__peter__@web.de> - 2013-08-08 17:44 +0200
Re: right adjusted strings containing umlauts Dave Angel <davea@davea.name> - 2013-08-08 15:50 +0000
Re: right adjusted strings containing umlauts Kurt Mueller <kurt.alfred.mueller@gmail.com> - 2013-08-08 18:16 +0200
Re: right adjusted strings containing umlauts Kurt Mueller <kurt.alfred.mueller@gmail.com> - 2013-08-08 18:27 +0200
Re: right adjusted strings containing umlauts wxjmfauth@gmail.com - 2013-08-09 01:30 -0700
Re: right adjusted strings containing umlauts Peter Otten <__peter__@web.de> - 2013-08-08 18:34 +0200
Re: right adjusted strings containing umlauts Chris Angelico <rosuav@gmail.com> - 2013-08-08 17:37 +0100
Re: right adjusted strings containing umlauts Dave Angel <davea@davea.name> - 2013-08-08 17:47 +0000
Re: right adjusted strings containing umlauts Terry Reedy <tjreedy@udel.edu> - 2013-08-08 16:51 -0400
Re: right adjusted strings containing umlauts Kurt Mueller <kurt.alfred.mueller@gmail.com> - 2013-08-23 17:47 +0200
Re: right adjusted strings containing umlauts Kurt Mueller <kurt.alfred.mueller@gmail.com> - 2013-08-28 10:01 +0200
Re: right adjusted strings containing umlauts Dave Angel <davea@davea.name> - 2013-08-28 10:23 +0000
Re: right adjusted strings containing umlauts kurt.alfred.mueller@gmail.com - 2013-08-28 04:17 -0700
csiph-web