[Tutor] RE:

Orri Ganel singingxduck at gmail.com
Tue Jan 18 09:31:28 CET 2005


Gopinath V, ASDC Chennai wrote:

> On Wed, 12 Jan 2005, Orri Ganel wrote:
>
> >  >>> stuff = [[0,'sdfsd','wrtew'], [1, 'rht','erterg']]
> >  >>> stuff
> > [[0, 'sdfsd', 'wrtew'], [1, 'rht', 'erterg']]
> >  >>> print [stuff[i][0] for i in range(len(stuff))]
> > [0, 1]
>
>
> Hi Orri,
>
> An alternative way to write this is:
>
> ###
> print [row[0] for row in stuff]
> ###
>
> which extracts the first element out of every "row" sublist in 'stuff'.
>
>
> Best of wishes!
>
>
>    This is fine.i just want to know if row is a reserve word ?
> or is it a built in function
>  in IDLe environment .. the word row is not highlighted ,what data 
> type is (row)
>
>------------------------------------------------------------------------
>
>_______________________________________________
>Tutor maillist  -  Tutor at python.org
>http://mail.python.org/mailman/listinfo/tutor
>  
>
 >>> row

Traceback (most recent call last):
  File "<pyshell#408>", line 1, in -toplevel-
    row
NameError: name 'row' is not defined
 >>> import row

Traceback (most recent call last):
  File "<pyshell#409>", line 1, in -toplevel-
    import row
ImportError: No module named row

Looks like its not a reserved word.

-- 
Email: singingxduck AT gmail DOT com
AIM: singingxduck
Programming Python for the fun of it.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050118/68b5ee04/attachment.html


More information about the Tutor mailing list