As a beginner in Python, I'm reading a book written by Bill Lubanovic
I found something weird.
In that book, After saving simple code in test1.py, which is
print("This standalone program works!")
it says python can run it by typing in
$ python test1.py
However, whenever I try to use that, syntax error happens.
Although I know there are other methods like using exec() which I found in this website, I wanna know why book uses that method which doesn't work at least for me.
It means you need to type everything but the
$
in the terminal.It's just a convention though. Authors also use
> python test1.py
and other notations.I don't know which version of his book you're reading, but he mentions it in this version.
Question was answered in following stackoverflow post: What does the $ mean when running commands?
What does the $ mean when running commands?
You are not supposed to enter the
$
.The
$
represents the shell/terminal prompt. This is the string of characters that appear in your terminal when it is waiting for input, although$
typically indicates some flavour of unix, e.g. linux.Your terminal will probably use a different prompt, e.g.
Or, if you are using a Windows terminal you might see :
or