I'm using Python 2.7 and I just have a simple question in my code i have
from sys import argv script, first, second, third = [argv, "bike","car","lemon"]
I know i can just say
and it will print on a line but is there a way to print this in a for loop where it would each of the values i know the logic would be something like
for x,y in ?: print(y)
Since this argument with the values isn't named i don't know what to put for in my question mark.
You could simply create a
tuple/list of objects iterate over it and print the current element.
for element in (script, first, second, third): print element >>> obj1 obj2 ...
However if you want to print all the objects in same line then you may use a
, comma after the print statement:
for element in (script, first, second, third): print element, >>> obj1 obj2 ...