Comma ,
for generating a tuple of length 1
>>> (1)
1
>>> (1,)
(1,)
>>> 1,
(1,)
Thus the length of the required element of the tuple can be extracted from a ,
simplified assignment
>>> a=(1,)
>>> b=a
>>> b
(1,)
>>> b,=a
>>> b
1
Finally print
print variable by ,
continuous printing operation does not wrap not work in the python3
Python 3.7.3 (default, Nov 15 2019, 04:04:52)
[Clang 11.0.0 (clang-1100.0.33.16)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> for i in range(0,5):
... print(i)
...
0
1
2
3
4
>>> for i in range(0,5):
... print(i,)
...
0
1
2
3
4