Home > Article > Backend Development > How to output every other character in python
How does python output every other character? Because there are differences in the output of Python2 and Python3, here we take Python2 and Python3 as examples:
python3: Add the end= ' ' parameter.
python2: End with comma. Two examples are as follows:
>>> a = [1, 2, 3, 4]
Related recommendations: "Python Video Tutorial"
python3 Compilation Environment
>>> for i in a: print(i, end=' ') 1 2 3 4
python2 compilation environment
>>> for i in a: print i, 1 2 3 4
The above is the detailed content of How to output every other character in python. For more information, please follow other related articles on the PHP Chinese website!