1th Chapterfirst onePythonprogram
Never copy and paste before writing code. Write a program also pay attention to a feeling, you need a letter a letter to the code to knock yourself in.
Python
>>> print ("Hello word")
Hello Word
>>>
Enter print ("Helloword") carriage return to both. This is called a string in double quotation marks.
And you can make him do the math,
>>> 200 + 100
300
>>> 200-100
100
>>> 200-300
-100
>>>
finally , exit python with exit () or quit ()
[[email protected] ~]# python
Python 2.6.6 (r266:84292, 18 2016, 15:13:37)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2
Type "Help", "copyright", "credits" or "license" for more information.
>>> exit ()
[Email protected] ~]#
The only flaw is that it's not saved, and it's going to have to be knocked out again the next time you run.
Linux can be python code written in a file and then specify the Python parsing
[Email protected] ~]# echo "Print (' Cao ')" >cao.py
[email protected] ~]# python cao.py
Cao
You can run the input ldle in Windows with ldle , double-click to open
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M02/9B/6B/wKiom1ljGEfzo88VAAAjyPh-Taw960.png "title=" 3.png "alt=" Wkiom1ljgefzo88vaaajyph-taw960.png "/>
Appears after opening
650) this.width=650; "src=" Https://s3.51cto.com/wyfs02/M00/9B/6B/wKiom1ljGFqSybYWAABtB94tmh0230.png "title=" 4.png "alt=" Wkiom1ljgfqsybywaabtb94tmh0230.png "/>
This is python 's interactive mode.
Same as the command line in Linux
650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M00/9B/6B/wKioL1ljGGjCoz_gAACWVbJPf8M151.png-wh_500x0-wm_ 3-wmp_4-s_1726785680.png "title=" 5.png "alt=" Wkiol1ljggjcoz_gaacwvbjpf8m151.png-wh_50 "/>
You can open a new file if you find it.
650) this.width=650; "src=" Https://s4.51cto.com/wyfs02/M01/9B/6B/wKiom1ljGHrR3jr2AACAgD0_xwI966.png "title=" 6.png "alt=" Wkiom1ljghrr3jr2aacagd0_xwi966.png "/>
Click Run the running Module to execute the python file you just wrote .
This article is from "No Lover" blog, please make sure to keep this source http://caojiaoyue.blog.51cto.com/11798573/1945904
The first Python program