Quick Start
1. Program OUTPUT PRINT statement
(1) Use the PRINT statement to view the value of the object, and output the string representation of the object in the interactive interpreter using the object itself;
(2) Use the Print statement to invoke the STR () display object, and invoke the Repr () display object in the interactive interpreter using the object itself
(3) Use _ In the interpreter has a special meaning, indicating the value of the last expression;
(4) using the string operator% can be used to replace the string function;
(5) Can implement string output redirection;
For example:
" Hello, World " Print Mystringhello,world >>> myString'Hello,World'>>> _ ' Hello, World '
For example:
Print " %s is%d " % ("python", 1 is 1
Import SYS Print " Fatal error:invalid input! " Fatal error:invalid input!
>>> logfile = open ("/tmp/logfile.txt""a") Print " Fatal error:invalid input! "
2. Program Input raw_input ()
(1) It is not recommended to use the print () and raw_input () functions in a function, but if the function is the input and output is not allowed;
(2) Use Help (raw_input) to view the documentation
For example:
3. Notes
(1) Use the # Comment line
(2) Document string Special note, you can implement the online document function, in the module, class, function of the structure of the first row to use
Python2.7 from getting started to mastering