Replies: 3 comments
-
not Open screenshot |
Beta Was this translation helpful? Give feedback.
-
Screenshot doesn't open |
Beta Was this translation helpful? Give feedback.
-
Because in Python 3, print statement has been replaced with a print() function, with keyword arguments to replace most of the special syntax of the old print statement. So you have to write it as; print("Hello World") But if you write this in a program and someone using Python 2.x tries to run it, they will get an error. To avoid this, it is a good practice to import print function: from future import print_function Now your code works on both 2.x & 3.x. Check out below examples also to get familiar with print() function. Old: print "The answer is", 22 Old: print x, # Trailing comma Old: print # Prints a newline Old: print >>sys.stderr, "fatal error" Old: print (x, y) # prints repr((x, y)) |
Beta Was this translation helpful? Give feedback.
-
Heyy does anyone hiw can i fix this
Beta Was this translation helpful? Give feedback.
All reactions