Re: Print formatting

2019-10-18 Thread D'Arcy Cain
On 10/18/19 5:00 PM, D'Arcy Cain wrote: Finally, if this is in a loop do this. FMT = '{0[0]:<12s}{0[3]:>12s}'.format for temp_list in GetLists(): print FMT(temp_list) Oops. Time warp. I meant "print(FMT(temp_list)) -- D'Arcy J.M. Cain Vybe Networks Inc. http://www.VybeNetworks.com/ IM:da...

Re: Print formatting

2019-10-18 Thread D'Arcy Cain
On 10/18/19 2:21 PM, Jagga Soorma wrote: I seem to have found a way to do this with the following: print('{:<12s}{:>12s}'.format((temp_list[0]),(temp_list[3]))) Still let me know if there is a better way to format this output :) I would start with removing the redundant parens. print('{:<1

Re: Print formatting

2019-10-18 Thread Jagga Soorma
I seem to have found a way to do this with the following: print('{:<12s}{:>12s}'.format((temp_list[0]),(temp_list[3]))) Still let me know if there is a better way to format this output :) Thanks, -J On Fri, Oct 18, 2019 at 10:03 AM Jagga Soorma wrote: > > Hello, > > I am new to python and try

Re: Print formatting

2019-10-18 Thread MRAB
On 2019-10-18 18:03, Jagga Soorma wrote: Hello, I am new to python and trying to write a script that outputs some data about users. I was able to write it and dump the data but can't seem to align the output in column 2 correctly. Here is what I am trying to do: -- output: user1 data1 use

Print formatting

2019-10-18 Thread Jagga Soorma
Hello, I am new to python and trying to write a script that outputs some data about users. I was able to write it and dump the data but can't seem to align the output in column 2 correctly. Here is what I am trying to do: -- output: user1 data1 username2 data2 user3 data3 s

Re: print formatting

2010-03-13 Thread Peter Otten
vsoler wrote: > My script contains a print statement: > > print '%40s %15d' % (k, m) > > However, > > 1- the string is right adjusted, and I would like it left > adjusted > 2- the number is a decimal number, and I would like it with > the thousands separator and 2

Re: print formatting

2010-03-13 Thread Steve Holden
vsoler wrote: > Hello, > > My script contains a print statement: > > print '%40s %15d' % (k, m) > > However, > > 1- the string is right adjusted, and I would like it left > adjusted > 2- the number is a decimal number, and I would like it with > the thousands sepa

print formatting

2010-03-13 Thread vsoler
Hello, My script contains a print statement: print '%40s %15d' % (k, m) However, 1- the string is right adjusted, and I would like it left adjusted 2- the number is a decimal number, and I would like it with the thousands separator and 2 decimals If possible, the

Re: float print formatting

2007-02-13 Thread hg
Grant Edwards wrote: > On 2007-02-13, hg <[EMAIL PROTECTED]> wrote: >> Hi, >> >> Considering the float 0.0, I would like to print 00.00. >> >> I tried '%02.02f' % 0.0 ... but I get 0.00 > ^^ > That's the specifierfor how many total columns you want to use > (including the decimal point

Re: Mulig SPAM: float print formatting

2007-02-13 Thread Grant Edwards
On 2007-02-13, hg <[EMAIL PROTECTED]> wrote: > NOSPAM plz wrote: >>> Considering the float 0.0, I would like to print 00.00. >>> >>> I tried '%02.02f' % 0.0 ... but I get 0.00 >> Try this: >> >> a = 45.45 # the floating number >> >> print "some text", >> print a, >> print "some text again" > S

Re: float print formatting

2007-02-13 Thread Grant Edwards
On 2007-02-13, hg <[EMAIL PROTECTED]> wrote: > Hi, > > Considering the float 0.0, I would like to print 00.00. > > I tried '%02.02f' % 0.0 ... but I get 0.00 ^^ That's the specifierfor how many total columns you want to use (including the decimal point and all digits to either side). >

Re: float print formatting

2007-02-13 Thread hg
Neil Cerutti wrote: > The eighth-graders will be presenting Shakespeare's Hamlet in the church > basement on Friday at 7 p.m. The congregation is invited to attend this > tragedy. --Church Bulletin Blooper ;-) I like that ! hg -- http://mail.python.org/mailman/listinfo/python-list

Re: float print formatting

2007-02-13 Thread Neil Cerutti
On 2007-02-13, hg <[EMAIL PROTECTED]> wrote: > Neil Cerutti wrote: > >> On 2007-02-13, hg <[EMAIL PROTECTED]> wrote: >>> Hi, >>> >>> Considering the float 0.0, I would like to print 00.00. >>> >>> I tried '%02.02f' % 0.0 ... but I get 0.00 >>> >>> Any clue ? >> >> Yes. How wide (total) is "0.00",

Re: float print formatting

2007-02-13 Thread hg
Peter Otten wrote: > hg wrote: > >> Considering the float 0.0, I would like to print 00.00. >> >> I tried '%02.02f' % 0.0 ... but I get 0.00 >> >> Any clue ? > > The first integer specifies the total width: > "%05.2f" % 0 > '00.00' > > Peter Many thanks ! hg -- http://mail.python.or

Re: float print formatting

2007-02-13 Thread Peter Otten
hg wrote: > Considering the float 0.0, I would like to print 00.00. > > I tried '%02.02f' % 0.0 ... but I get 0.00 > > Any clue ? The first integer specifies the total width: >>> "%05.2f" % 0 '00.00' Peter -- http://mail.python.org/mailman/listinfo/python-list

Re: Mulig SPAM: float print formatting

2007-02-13 Thread hg
NOSPAM plz wrote: > hg skrev: >> Hi, >> >> Considering the float 0.0, I would like to print 00.00. >> >> I tried '%02.02f' % 0.0 ... but I get 0.00 >> >> Any clue ? >> >> Thanks, >> >> hg >> >> > Try this: > > a = 45.45 # the floating number > > print "some text", > print a, > print "some tex

Re: float print formatting

2007-02-13 Thread hg
Neil Cerutti wrote: > On 2007-02-13, hg <[EMAIL PROTECTED]> wrote: >> Hi, >> >> Considering the float 0.0, I would like to print 00.00. >> >> I tried '%02.02f' % 0.0 ... but I get 0.00 >> >> Any clue ? > > Yes. How wide (total) is "0.00", compared to "00.00"? > > -- > Neil Cerutti I do not get

Re: float print formatting

2007-02-13 Thread Neil Cerutti
On 2007-02-13, hg <[EMAIL PROTECTED]> wrote: > Hi, > > Considering the float 0.0, I would like to print 00.00. > > I tried '%02.02f' % 0.0 ... but I get 0.00 > > Any clue ? Yes. How wide (total) is "0.00", compared to "00.00"? -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-li

Re: Mulig SPAM: float print formatting

2007-02-13 Thread NOSPAM plz
hg skrev: > Hi, > > Considering the float 0.0, I would like to print 00.00. > > I tried '%02.02f' % 0.0 ... but I get 0.00 > > Any clue ? > > Thanks, > > hg > > Try this: a = 45.45 # the floating number print "some text", print a, print "some text again" or just this: print "some text", prin

float print formatting

2007-02-13 Thread hg
Hi, Considering the float 0.0, I would like to print 00.00. I tried '%02.02f' % 0.0 ... but I get 0.00 Any clue ? Thanks, hg -- http://mail.python.org/mailman/listinfo/python-list