標籤:python tutorials 常用鍵以及機制
Python網上學習tutorials:
常用的鍵:
ctrl+D或者quit()來退出python
C-A (Control-A) moves the cursor to the beginning of the line, C-E to the end, C-B moves it one position to the left, C-F to the right. Backspace erases the character to the left of the cursor, C-D the character to its right. C-K kills (erases) the rest of the line to the right of the cursor, C-Y yanks back the last killed string. C-underscore undoes the last change you made;C-P moves one line up (back) in the history buffer, C-N moves one down.
IPython, which features tab completion, object exploration and advanced history management. It can also be thoroughly customized and embedded into other applications. Another similar enhanced interactive environment is bpython。
Python will execute the contents of a file identified by the PYTHONSTARTUP environment variable when you start an interactive interpreter.
機制:
When called with standard input connected to a tty device, it prompts for commands and executes them until an EOF (an end-of-file character, you can produce that with Ctrl-D on UNIX or Ctrl-Z, Enter on Windows) is read.
When called with a file name argument or with a file as standard input, it reads and executes a script from that file.
When called with a directory name argument, it reads and executes an appropriately named script from that directory.
When called with -c command, it executes the Python statement(s) given as command. Here command may contain multiple statements separated by newlines. Leading whitespace is significant in Python statements!
When called with -m module-name, the given module is located on the Python module path and executed as a script.
Note that the hash, or pound, character, ‘#‘, is used to start a comment in Python.
The last printed expression is assigned to the variable _;Don’t explicitly assign a value to it — you would create an independent local variable with the same name masking the built-in variable with its magic behavior.The string is enclosed in double quotes if the string contains a single quote and no double quotes, otherwise it is enclosed in single quotes.
可以參考與借鑒的網站:https://docs.python.org/2/tutorial/interpreter.html
http://python.org/
本文出自 “雲淡風輕” 部落格,請務必保留此出處http://htlbydgod.blog.51cto.com/9829379/1630699
Python tutorials 常用鍵以及機制