Re: Printing lists in columns

2007-09-05 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > Thanks guys, I really appreciate it. I have never used google groups > before Actually, comp.lang.python is a usenet newsgroup, not a google group. Google only gives you a web fronted (and archives...) for that group. I personnaly access it with my MUA. > and am so

RE: Printing lists in columns

2007-09-05 Thread Ryan Ginstrom
> On Behalf Of [EMAIL PROTECTED] > bo, daf, da > pres, ppar, xppc > magnjklep, *, dsa > *, *, nbi > > But I want it justified, i.e: > > bo , daf, da > pres , ppar, xppc > magnjklep,*, dsa > *,*, nbi Once you have a nice rectangular list of lists, you might want to

Re: Printing lists in columns

2007-09-05 Thread Amit Khemka
On 9/5/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Thanks guys, I really appreciate it. I have never used google groups > before and am so impressed with how helpful you all are. It is also lovely > that none of you mock my little knowledge of Python but just want to > improve it. And we ar

Re: Printing lists in columns

2007-09-05 Thread cjt22
Thanks guys, I really appreciate it. I have never used google groups before and am so impressed with how helpful you all are. It is also lovely that none of you mock my little knowledge of Python but just want to improve it. I have another question in relation to the izip_longest function (I persu

Re: Printing lists in columns

2007-09-04 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : > On Sep 4, 3:20 pm, Bruno Desthuilliers [EMAIL PROTECTED]> wrote: > >>[EMAIL PROTECTED] a écrit : >>(snip) >> >> >>>Thanks guys >> >>>I have a list of lists such as >>> a = ["1" , "2"] b = ["4", "5", "6"] c = ["7",8", "9"] >>>Stored in another list: d = [a,b,c] >> >

Re: Printing lists in columns

2007-09-04 Thread Miles
On 9/4/07, Hrvoje Niksic wrote: > Python isn't too happy about adding individual keyword arguments after > an explicit argument tuple. Try this instead: > > for row in izip_longest(*d, **dict(fillvalue='*')): > print ', '.join(row) Or simply: for row in izip_longest(fillvalue='*', *d):

Re: Printing lists in columns

2007-09-04 Thread Hrvoje Niksic
[EMAIL PROTECTED] writes: >> for row in izip_longest(*d, fillvalue='*'): >> print ', '.join(row) >> >> HTH > > I thought that but when I tried it I recieved a > "Syntax Error: Invalid Syntax" > with a ^ pointing to fillvalue :S Python isn't too happy about adding individual keyword arguments

Re: Printing lists in columns (was: TypeError: 'module object is not callable')

2007-09-04 Thread Duncan Booth
[EMAIL PROTECTED] wrote: > I know this makes me sound very stupid but how would I specify > in the parameter the inner lists without having to write them all out > such as: > > for row in izip_longest(d[0], d[1], d[2], fillvalue='*'): > print ', '.join(row) > > i.e. How could I do the follow

Re: Printing lists in columns

2007-09-04 Thread cjt22
On Sep 4, 3:20 pm, Bruno Desthuilliers wrote: > [EMAIL PROTECTED] a écrit : > (snip) > > > Thanks guys > > > I have a list of lists such as > > a = ["1" , "2"] b = ["4", "5", "6"] c = ["7",8", "9"] > > Stored in another list: d = [a,b,c] > > > I know this makes me sound very stupid but how woul

Re: Printing lists in columns

2007-09-04 Thread cjt22
On Sep 4, 3:20 pm, Bruno Desthuilliers wrote: > [EMAIL PROTECTED] a écrit : > (snip) > > > Thanks guys > > > I have a list of lists such as > > a = ["1" , "2"] b = ["4", "5", "6"] c = ["7",8", "9"] > > Stored in another list: d = [a,b,c] > > > I know this makes me sound very stupid but how woul

Re: Printing lists in columns

2007-09-04 Thread Bruno Desthuilliers
[EMAIL PROTECTED] a écrit : (snip) > Thanks guys > > I have a list of lists such as > a = ["1" , "2"] b = ["4", "5", "6"] c = ["7",8", "9"] > Stored in another list: d = [a,b,c] > > I know this makes me sound very stupid but how would I specify > in the parameter the inner lists without havin

Re: Printing lists in columns (was: TypeError: 'module object is not callable')

2007-09-04 Thread cjt22
On Sep 4, 2:06 pm, Duncan Booth <[EMAIL PROTECTED]> wrote: > [EMAIL PROTECTED] wrote: > >> But watch out if the lists aren't all the same length: zip won't pad out > >> any sequences, so it maynotbe exactly what is wanted here: > > >> >>> x = ['1', '2', '3'] > >> >>> y = ['4', '5'] > >> >>> for row

Re: Printing lists in columns (was: TypeError: 'module object is not callable')

2007-09-04 Thread Duncan Booth
[EMAIL PROTECTED] wrote: >> But watch out if the lists aren't all the same length: zip won't pad out >> any sequences, so it maynotbe exactly what is wanted here: >> >> >>> x = ['1', '2', '3'] >> >>> y = ['4', '5'] >> >>> for row in zip(x,y): >> >> print ', '.join(row) >> >> 1, 4 >> 2, 5 >

Re: Printing lists in columns (was: TypeError: 'module object is not callable')

2007-09-04 Thread cjt22
> But watch out if the lists aren't all the same length: zip won't pad out > any sequences, so it maynotbe exactly what is wanted here: > > >>> x = ['1', '2', '3'] > >>> y = ['4', '5'] > >>> for row in zip(x,y): > > print ', '.join(row) > > 1, 4 > 2, 5 > Unfortunately the lists will be of

Re: Printing lists in columns (was: TypeError: 'module object is not callable')

2007-09-04 Thread Duncan Booth
"A.T.Hofkamp" <[EMAIL PROTECTED]> wrote: >> Each loop I perform, I get a new list of Strings. >> I then want to print these lists as columns adjacent to each other >> starting with the first >> created list in the first column and last created list in the final >> column. > > Use zip: > x =

Printing lists in columns (was: TypeError: 'module object is not callable')

2007-09-04 Thread A.T.Hofkamp
On 2007-09-04, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Thanks guys. Changing to how Python does things has a lot of geting > used to! That's part of the fun :-) > Do any of you have any ideas on the best way to do the following > problem: > > Each loop I perform, I get a new list of String