0
Python print statement
Is this statement valid print "Hello World" because in unix it gets executed but in windows it ask us to put the braces()
4 ответов
+ 7
#to simplify visphs post further into an example:
print "hi" #works in python2.7
print("hi") #works in all python versions
+ 7
You can also do this:
apples = print
apples ("Hi")
... which I think is funny
+ 6
It's not a difference due to OS, but to Python version:
Before Python3, 'print' was a statement and could be used as a function ( with the 'braces' () )
Since Python3, it's no more a statement and need to be use as a function call ( with the 'braces' () )
+ 5
@Ahri:
print("hi") # works in all Python versions ;P