![]() |
how to do * wild cards in python
If I import a bunch of lists from 'data' say:
stuff1=[("a", "b", "c'), ("a", "b", "c')] ... stuff200=[("a", "b", "c'), ("a", "b", "c')] how can I: print data.stuff*[0] ? |
if the stuff variables are global, try
Code:
for (k,v) in locals().items():something like: Code:
stuff = {} |
Thank you.
This sounds good, how would I check field [0][2] off all the stuff[1]- stuff[100]? |
Code:
#!/usr/bin/env pythonCode:
#!/usr/bin/env python |
Not sure exactly what you mean. Do you want to compare for example somelist[0][2] with all the other values present in the list?
|
Quote:
Code:
stuff[0][2]remember - the index of the first value in a tuple/array is zero. read more in http://docs.python.org/tut/tut.html and http://docs.python.org/tut/node7.html |
Not sure what you mean by "check" all the entries at [0][2], but if you want a list of all the entries at [0][2] for checking, then you could use list comprehension:
Code:
# for a dict |
| All times are GMT -5. The time now is 01:44 AM. |