python是一種強調代碼可讀性以及簡潔的語言
python並不使用大括號以及分號 而是使用縮排來作為程式的執行依據
安裝
ubuntu
$ sudo apt-get install python3.5
測試安裝是否成功
$ python3
Python 3.5.2 (default, Nov 23 2017, 16:37:01)
[GCC 5.4.0 20160609] on linux
Type “help”, “copyright”, “credits” or “license” for more information.
>>> print(“hello world”)
hello world
簡單語法介紹
1.print
print(“hello world!!”)
hello world!!
2.for….in
for i in range(5):
print(i)
(1)if….:
i=5
if i=5:
print(“12345”)
else:
print(“error”)
12345
(2)if….:
else:
i=6
if i=5:
print(“12345”)
else:
print(“error”)
error
更多語法資訊學習網站
codecademy
https://www.codecademy.com/
具有多種語言可以學習的網站
筆者的python也是再這個網頁學習的
转载请注明:XAMPP中文组官网 » Python安裝及簡單語法介紹