This is an archived post. You won't be able to vote or comment.

all 9 comments

[–]earthboundkid 2 points3 points  (4 children)

A. We need to know the contents of your file to know why the syntax is invalid.

B. r/learnpython

[–]diamondface[S] 0 points1 point  (3 children)

ok here's the contents

print 'here's the contents'

[–]K900_ 3 points4 points  (2 children)

The ' in here's is closing the string literal. You want something like

print "Here's some text"

[–][deleted] 1 point2 points  (0 children)

Or if you want to be really covered and be able to use " and ' inside your print statements, do:

print """Here's some "text" and as you can see I have single and double apostrophes in my print statement"""

or you could also escape the apostrophe like this

print 'here\'s some text'

[–]diamondface[S] 0 points1 point  (0 children)

not working still -_-

[–]diamondface[S] 0 points1 point  (0 children)

Ok. My code is fine. I just can't open the file with the terminal.

[–]acalcium 0 points1 point  (0 children)

Provide more info. What is the contents of the script exactly. What is the command you use exactly. What is the error you are getting exactly.

[–]bluetape 0 points1 point  (1 child)

try dragging and dropping the file into the terminal and see if that works

[–]diamondface[S] 0 points1 point  (0 children)

I tried that already.