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

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