0

Python 2.7

When I try and execute a python script, I get an invalid syntax error.

powershell.exe 'c:\pythonscripts\ex1.py'
File "<stdin>", line 1
powershell.exe 'c:\pythonscripts\ex1.py'
                                       ^

I know it works because I just executed a file with this command. the code for the .py is

print "Hello World!"
print "Hello Again"
print "I like typing this."
print "This is fun."
print 'Yay! Printing.'
print "I'd much rather you 'not'."
print 'I "said" do not touch this.

Python 2.7

2
  • 2
    You're missing a ' after the last print statement, or was this a mistake in formatting your question Commented Mar 3, 2013 at 0:57
  • Thank you :) It was the mistake... Derp me lol. Now I just need to figure out how to pause.... Thanks again :) Commented Mar 3, 2013 at 1:03

1 Answer 1

2

As shown in the comments, you're mistake is that you forgot an apostrophe in your last print statement.

print 'I "said" do not touch this.'

Have fun learning python. LPTHW is a great way to learn it :).

Sign up to request clarification or add additional context in comments.

1 Comment

@user2127874 if you found the answer helpful, could you please accept the answer (click the tick) to show others it was the most helpful answer? Thanks :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.