0

How can I obtain an item from a tuple by index??

For example in ("a", "b", "c") obtain the index 1 ("b")

31st Jan 2017, 9:14 AM
MIGUEL GARCÍA GÓMEZ
MIGUEL GARCÍA GÓMEZ - avatar
2 odpowiedzi
+ 1
You can also 'dispatch' the content of a tupple in a serie of variables: a = 0 b = 0 c = 0 a, b, c = ( 1, 2, 3) print(str(a)+':'+str(b)+':'+str(c)) # output "1:2:3"
31st Jan 2017, 11:39 AM
visph
visph - avatar
0
not sure your exact question but if your tuple was named myTuple then it would be myTuple[1] for example if you coded: myTuple = ("a", "b", "c") myTuple[1] // would return "b"
31st Jan 2017, 9:18 AM
Bill
Bill - avatar