Rookie Question: Passing a nested list into a function?

Brett bjgol at yahoo.com
Thu Apr 14 23:15:59 EDT 2005


I think so.  I later reference it as textfilelist[0][0].  My intent is to be 
able to use: titlelist1[x][1] as part of my "if" statement in my function.

-Brett



"James Stroud" <jstroud at mbi.ucla.edu> wrote in message 
news:mailman.1945.1113532023.1799.python-list at python.org...
>
> Do you really want quotation marks around "titlelist1[x][1]" ?
>
> e.g.
>
>>>> textfilelist = [["titlelist1[x][1]"]]
>>>> textfilelist[0][1]
> Traceback (most recent call last):
>  File "<stdin>", line 1, in ?
> IndexError: list index out of range
>
>
>
> On Thursday 14 April 2005 06:51 pm, Brett wrote:
>> I am trying to pass the value of a nested list into a function (to my 
>> "if"
>> statement) as follows:
>>
>> textfilelist = [["titlelist1[x][1]"]]
>> def idfer(listlength, comparelistlength, list):
>>         while x < (listlength - 1):
>>                        while y < comparelistlength:
>>                             if list == titlelist2[y][1]:
>> (I cutoff the end to focus on the problem)
>>
>> #Here i call my function hoping i am passing the value within
>> textfilelist[0][0] to my function
>> idfer(textfilelist[0][1], textfilelist[1][1], textfilelist[0][0])
>>
>>
>> --------------
>> I don't if there is a "legal" way to do this, but I would appreciate some
>> guidance.
>>
>> Thanks,
>>
>> Brett
>
> -- 
> James Stroud, Ph.D.
> UCLA-DOE Institute for Genomics and Proteomics
> Box 951570
> Los Angeles, CA 90095
>
> http://www.jamesstroud.com/ 





More information about the Python-list mailing list