1, use, remove the extra line break
>>> 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
It is obvious that the print statement defaults to a newline followed by a comma followed by a newline that becomes a space
After a comma is appended to the assignment expression, a tuple object is automatically obtained
>>> A = 1
>>> B = 2,
>>> print Type (a)
<type ' int ' >
>>> print type (b)
<type ' tuple ' >
>>> C = []
>>> d = [],
>>> print type (c)
<type ' list ' >
>>> print type (d)
<type ' tuple ' >
2. The use of commas in type conversions is mainly the conversion of tuples
After a comma is added to the assignment expression, a tuple object is automatically obtained, and the desired result is not obtained when some type-related work or serialization is required. When you encounter a similar phenomenon in your work, you can put this into your own checklist.
>>> Print C
[]
>>> Print D
([],)
>>> Print a
1
>>> Print B
(2,)
3. Add it after the Django list,
The role of commas in note-python