TypeError: 'module object is not callable'

Amit Khemka khemkaamit at gmail.com
Tue Sep 4 07:03:05 EDT 2007


On 9/4/07, cjt22 at bath.ac.uk <cjt22 at bath.ac.uk> wrote:
> On Sep 4, 11:24 am, "Amit Khemka" <khemkaa... at gmail.com> wrote:
> > On 9/4/07, Chris.T... at jet.uk <Chris.T... at jet.uk> wrote:
> >
> > > Thanks guys. Changing to how Python does things has a lot of geting
> > > used to!
> > > 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 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.
> >
> > > If you need any more information, just let me know!
> > > Cheers
> >
> > If I understand correctly what you may want is:
> >
> > >>> l =  ['1', '2', '3', '4']
> >
> > you can do:
> >
> > >>> print "\t".join(l)  # lookup join method in stringmodule,
> >
> > assuming "\t" as the delimiter
> >
> > or,
> >
> > >>> for i in l:
> >
> > ....     print i, '\t' ,   # note the trailing ","
> >
> > If this isnotwhat you want, post an example.
> >
> > Btw, Please post new issues in a separate thread.
> >
> > Cheers,
> > --
> > ----
> > Amit Khemka
> > website:www.onyomo.com
> > wap-site:www.owap.in
>
> I think that is very similar to what I want to do.
> Say I had lists a = ["1" , "2", "3"]  b = ["4", "5", "6"]  c = ["7",
> "8", "9"]
> Stored in another list d = [a,b,c]
> I want the printed output from d to be of the form:
> 1   4   7
> 2   5   8
> 3   6   9
>
> >From what I am aware, there is no table module to do this. The '\t'
> operator looks like it can allow this,
> I am playing with it at the moment, although going for my lunch break
> now!

Have a look at function 'zip' or function 'izip' in module "itertools" .

-- 
----
Amit Khemka
website: www.onyomo.com
wap-site: www.owap.in



More information about the Python-list mailing list