Re: Formatting string with accented characters for printing

2015-01-27 Thread John Ladasky
Jerry, I can tell from your code that you are using Python 2. If you are a new Python programmer, and you do not HAVE to use Python 2, use Python 3 instead. In Python 3, text objects are something called "Unicode" rather than just sequences of bytes. Unicode makes it much easier to handle cha

Re: Formatting string with accented characters for printing

2015-01-18 Thread Peter Otten
Jerry Rocteur wrote: > 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 > th

Re: Formatting string with accented characters for printing

2015-01-18 Thread Chris Angelico
On Mon, Jan 19, 2015 at 3:04 AM, Jerry Rocteur wrote: > > 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

Formatting string with accented characters for printing

2015-01-18 Thread Jerry Rocteur
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: