I was wondering if we can print like row-wise in python.
Basically I have a loop which might go on million times and I am printing out some strategic counts in that loop
Python 3:
l = [3.14, 'string', ('tuple', 'of', 'items')]
print(', '.join(map(repr, l)))
Output:
3.14, 'string', ('tuple', 'of', 'items')
For python 2:
for x in num:
print x,
For python 3:
for x in num:
print(x, end = ' ')
Just add a ,
at the end of the item you're printing.
print x,
# 3 4
The simplest way:
print(list(iter(x)))
Output:
[3, 4, ... and so on]