Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

the meaning of #! in python separately [duplicate]

Tags:

python

I could add #! /usr/bin/python in the beginning of python script and add this script to PATH in order to run it as a command.

But could anyone explain to me what does '#' and '!' mean separately in python and what other language has this mechanism? Thanks

like image 646
f4fc2791e4473eb2ba41b5ddb445b2 Avatar asked Nov 16 '14 06:11

f4fc2791e4473eb2ba41b5ddb445b2


People also ask

What the meaning of meaning?

1a : the thing one intends to convey especially by language : purport Do not mistake my meaning. b : the thing that is conveyed especially by language : import Many words have more than one meaning. 2 : something meant or intended : aim a mischievous meaning was apparent.

What type of word is the?

In the English language the word the is classified as an article, which is a word used to define a noun. (More on that a little later.)

How do you use the word the?

The is used to refer to specific or particular nouns; a/an is used to modify non-specific or non-particular nouns. We call the the definite article and a/an the indefinite article. For example, if I say, "Let's read the book," I mean a specific book.


2 Answers

This is the shebang line and the #! are magic numbers interpreted by the program loader on unix systems and used to start the script interpreter.

like image 165
Elliott Frisch Avatar answered Oct 27 '22 13:10

Elliott Frisch


# followed by anything is a comment; so far as Python itself is concerned, that's it. Unix, on the other hand, will parse out the /usr/bin/python so that it knows how to run your code.

like image 32
Kevin Avatar answered Oct 27 '22 12:10

Kevin