Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #83992
| From | Jerry Rocteur <jerry.rocteur@gmail.com> |
|---|---|
| Date | 2015-01-18 17:04 +0100 |
| Subject | Formatting string with accented characters for printing |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.17838.1421604508.18130.python-list@python.org> (permalink) |
Hi,
When I try and format output when there are accented characters the
output does not look right.
e.g.
27 Angie Dickons 67,638
28 Anne MÉRESSE 64,825
So the strings containing accented characters print one less than
those that don't.
I've tried both:
print '{0:2} {1:25} {2} '.format( cnt, nam[num].encode('utf-8'),
steps[ind1])
print "%3d %-25s %-7s" % ( cnt, nam[num].encode('utf-8'), steps[ind1])
I've searched but I can't see a solution..
I guess it is the way I'm printing nam[num].encode('utf-8') perhaps I
have to convert it first ?
Can someone please help.
Thanks
--
Jerry Rocteur
Jerry@rocteur.com
Back to comp.lang.python | Previous | Next — Next in thread | Find similar | Unroll thread
Formatting string with accented characters for printing Jerry Rocteur <jerry.rocteur@gmail.com> - 2015-01-18 17:04 +0100 Re: Formatting string with accented characters for printing John Ladasky <john_ladasky@sbcglobal.net> - 2015-01-27 11:16 -0800
csiph-web