user2893825 user2893825 - 14 days ago 4x
Python Question

Comma does not separate lines of print in python34 on windows8?

I am learning python34 and I read here in my course book the following line:

"The comma separating the two print() commands in this file instructs Python to no start a new

I am guessing by "no" they actually mean not?

Using the next script:

#!/usr/bin/env python3

print ("Hello from a Python file!"),
print ("Welcome to Python!")

And I have the following example of its execution on mac:

$ python3 ~/Desktop/Python/
Hello from a Python file! Welcome to Python!

But my windows8 gives me this output:

Hello from a Python file!
Welcome to Python!

I am running the file via cmd without the Python command (as shown above), since it doesn't work otherwise...
I added manually the system Environment Variables path to Python default installation
folder (C:\Python34)


The comma doesn't work in Python3, see what's new in Python 3. Also see the docs for print function in Python 3.

Old: print x,           # Trailing comma suppresses newline
New: print(x, end=" ")  # Appends a space instead of a newline

Your example would be:

>>> def test():
...   print("Hello from a Python file!", end=" ")
...   print("Welcome to Python!")
>>> test()
Hello from a Python file! Welcome to Python!