EDIT2: (Thanks Padraic Cunningham)
This is the error I get when I try this in the interpreter,
>>> print s
Tony1
7684 dogs
Garry 2
8473 dogs
sara111
0 dogs
>>> spl = s.lstrip().splitlines()
>>>
>>> for it1, it2 in zip(spl[::2],spl[1::2]):
... print("{} {}".format(it1 ,it2))
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
ValueError: zero length field name in format
EDIT:
Im sorry this did not solve what I was looking for, I need to do this with words, for example my output on regex looks like:
Tony1
7684 dogs
Garry 2
8473 dogs
sara111
0 dogs
I need it to look like:
Tony1 7684 dogs
Garry 2 8473 dogs
sara111 0 dogs
Is this possible?
Original:
I would like to make several statements that give standard output without seeing newlines in between statements.
Specifically, suppose I have:
for item in range(1,100):
print item
The output looks like:
1
2
3
4
.
.
.
How get this to instead look like:
1 2
3 4
5 6
7 8