I have the following code:
print '''
Hello World
''''
It works well with Python 2 but does not work with Python 3:
Python 3.2.3 (default, Dec 10 2012, 06:30:54)
[GCC 4.5.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> print '''
... hello world
... '''
File "<stdin>", line 3
'''
^
SyntaxError: invalid syntax
>>>
What am I doing wrong?
It's not a problem of multi-line, but a problem of print
.
print
was replaced with a function print()
in python 3, so that you have to call it as a function.
print 'hello'
print('hello')
For your case, try
print('''
Hello,
World
''')