DCragg
DCragg

Reputation: 31

Python: Invalid Syntax on line 1 (file <string>)

I'm new to python and programming in general and I wrote this code on Sublime Text, and I can't see the error in it.

print("Please enter a quote you would like to use: ")
quote = str(input())
print(quote.upper())
print()
print(quote.lower())
print()
print(quote.capitalise())
print()
print(quote.title())

Any help would be much appreciated.

Many thanks, Dan

Upvotes: 2

Views: 28652

Answers (2)

TerryA
TerryA

Reputation: 59974

The reason isn't about whether to use raw_input() or input(). It's about taking an input in the first place. Sublime Text does not allow a user to give an input. Refer to here: Sublime Text 2 console input.

You can try SublimeREPL

Upvotes: 0

mishik
mishik

Reputation: 10003

Replace input() with raw_input():

print("Please enter a quote you would like to use: ")
quote = str(raw_input())

Or even:

quote = raw_input("Please enter a quote you would like to use: ")

Upvotes: 7

Related Questions