Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Pythonwin - print function not working [duplicate]

I'm running pywin32 build 216.1 and am having trouble using the simple print function - for example:

>>> print 'Hello!'

should return:

Hello!

but instead I get:

Traceback (  File "<interactive input>", line 1
    print 'Hello!'
                      ^
SyntaxError: invalid syntax

It doesn't matter what I try and use with print, it gives me this same error. I am able to do other things just fine as long as they don't involve the use of the print function. Can anyone help?

like image 720
Jay Gatsby Avatar asked Jul 20 '11 19:07

Jay Gatsby


People also ask

What is the use of print () function in Python?

The python print () function as the name suggests is used to print a python object (s) in Python as standard output. Object (s): It can be any python object (s) like string, list, tuple, etc. But before printing all objects get converted into strings.

What is the difference between print() and W() function in Python?

When we call the print () function, the text will be written into the file directly. ``` # ‘ w ’ flag is used to write to the file. demo = open ( ‘ demo.txt ’, ‘w’ ) print ( “ Welcome ” ) demo.close () ``` Q#1) Difference between print in Python2 and Python3.

How to print a word in Python?

``` print ( ‘ -Hello ’*5 <numbers you want to print the word>) ``` In Python, the print () function supports the “ file ” argument. It specifies or tells the program where the function should write in a given object. By default, it is sys.stdout. It will specify the file parameter as sys.stderr. It is mainly used while debugging small programs.

What is the default value of print in Python?

Default value = single space end : The value is printed after all the specified objects are printed. Default value = Newline ``` a = ‘Welcome’ b = ‘Python’ print (a, end = ‘ & ’) print (b) ```


1 Answers

In Python 3, print is a function, not a statement. Call it like:

print("Hello!")
like image 181
Wooble Avatar answered Oct 01 '22 02:10

Wooble