I'm trying to combine a string with a series of numbers as tuples to a list.
For example, starting with:
a = [12,23,45,67,89]
string = "John"
tuples = [(12,'John'),(23,'John'),(45,'John'),(67,'John'),(89,'John')]
string2 = string * len(a)
tuples = zip(a, string2)
tuples = [(12,'J'), (23,'o'), ...]
>>> a = [12,23,45,67,89]
>>> string = "John"
>>> my_tuple = [(i,string) for i in a]
>>> print my_tuple
You can iterate over each position within a string so zip
causes the behavior you were seeing previously.