-1

The end keyword used with print statement is not working in my PYTHON UBUNTU(neither in sublime nor in pycharm ce nor in terminal. Not even by importing sys and time

I tried importing sys and time and using time.sleep(),sys.stdout.write(), sys.stdout.flush() too

This Is the Code

print("Hi",end=" ")
print("hello")

Error Message:

file "/home/ansh/Desktop/fun.py", line 3
print("Hello", end = " ")
                    ^
SyntaxError: invalid syntax
[Finished in 0.1s with exit code 1]
[shell_cmd: python -u "/home/ansh/Desktop/fun.py"]
[dir: /home/ansh/Desktop]
[path: /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:                /bin:/usr/games:/usr/local/games:/snap/bin]
1
  • 3
    You're trying to use Python 3 syntax in Python 2.x. Commented Jun 20, 2019 at 21:58

1 Answer 1

0

Looks like you're using Python 2.x instead of 3.x.

The same thing can be achieved in Python 2.x with this:

print "Hi", 
print "hello"
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.