[Tutor] How to get value of sublist as return to verify in other file
shweta kaushik
coolshwetu at gmail.com
Mon Jan 5 18:38:16 CET 2015
Hi All,
I need help for list.
I am having one list of list
list = [[1, 2, 3, 4], [1, 5, 9, 11,5], [1, 6, 7, 2]]
In this list i am getting sublist value as shown below:
>>> list = [[1,2,3,4,5],[2,3,4,4,6],[3,4,5,4,6],[1,4,5,4,8]]
>>> for sublist in list:
... if sublist[3] == 4:
... print sublist[3]
...
4
4
4
4
>>>
I want sublist[3] value when matched first time and don't want the value
for second match.
And also i want to return same sublist value i.e. sublist[3] and want to
get the value of sublist[3] in another file.
Please provide any solution how to do this.
thanks all in advance.
Regards,
Shweta
More information about the Tutor
mailing list