這段日子決定學習python,開發一個運維繫統,所有記錄自己寫下的點點滴滴
直接開始,不說廢話了
好的開發首先需要一個好的開發平臺,首先需要安裝eclipse+python插件
1 python基礎
主要說到python的基本幾個方面:註釋,變量,運算符,和基本python類型
註釋
python的註釋是用#表示,如果它是在一行裏的第一個字符,那麼整行就都是註釋
#還可以在行的中間,這代表從#開始的地方起同行中剩下的部分都屬於註釋
# this entire lines ls a comment
foo = 1 #short comment :assign int 1 to foo
print 'python and %s are number %d' % ('Django',foo)
運行結果爲
python and Django are number 1
變量和賦值
>>> foo = 'bar'
>>> foo
'bar'
>>> foo = 1
>>> foo
1
運算符
包括算術運算符如 + – *