有想學(xué)python是兩年前的事情了轨功,為什么現(xiàn)在突然就要開始學(xué)了呢鲁僚?
1炊苫、興趣
大學(xué)里學(xué)的是通信工程,對(duì)編程一直很感興趣冰沙。而且在學(xué)校還自學(xué)過java侨艾,但是后來就沒有后來。我對(duì)學(xué)習(xí)編程的星星之火就沒有滅過拓挥,現(xiàn)在剛好有時(shí)間就開始自學(xué)吧唠梨。
2、爬蟲侥啤、數(shù)據(jù)分析
python是最簡(jiǎn)單的編程語言当叭、易上手,做爬蟲和數(shù)據(jù)分析的最佳語言盖灸。
3蚁鳖、python之禪
在 Python 解釋器下輸入
import this
會(huì)出來這樣一首小詩:
The Zen of Python, by Tim Peters
Beautiful is better than ugly.
Explicit is better than implicit.
Simple is better than complex.
Complex is better than complicated.
Flat is better than nested.
Sparse is better than dense.
Readability counts.
Special cases aren't special enough to break the rules.
Although practicality beats purity.
Errors should never pass silently.
Unless explicitly silenced.
In the face of ambiguity, refuse the temptation to guess.
There should be one-- and preferably only one --obvious way to do it.
Although that way may not be obvious at first unless you're Dutch.
Now is better than never.
Although never is often better than *right* now.
If the implementation is hard to explain, it's a bad idea.
If the implementation is easy to explain, it may be a good idea.
Namespaces are one honking great idea -- let's do more of those!
翻譯:
Python之禪 by Tim Peters
優(yōu)美勝于丑陋(Python 以編寫優(yōu)美的代碼為目標(biāo))
明了勝于晦澀(優(yōu)美的代碼應(yīng)當(dāng)是明了的,命名規(guī)范赁炎,風(fēng)格相似)
簡(jiǎn)潔勝于復(fù)雜(優(yōu)美的代碼應(yīng)當(dāng)是簡(jiǎn)潔的才睹,不要有復(fù)雜的內(nèi)部實(shí)現(xiàn))
復(fù)雜勝于凌亂(如果復(fù)雜不可避免,那代碼間也不能有難懂的關(guān)系,要保持接口簡(jiǎn)潔)
扁平勝于嵌套(優(yōu)美的代碼應(yīng)當(dāng)是扁平的琅攘,不能有太多的嵌套)
間隔勝于緊湊(優(yōu)美的代碼有適當(dāng)?shù)拈g隔垮庐,不要奢望一行代碼解決問題)
可讀性很重要(優(yōu)美的代碼是可讀的)
即便假借特例的實(shí)用性之名,也不可違背這些規(guī)則(這些規(guī)則至高無上)
不要包容所有錯(cuò)誤坞琴,除非你確定需要這樣做(精準(zhǔn)地捕獲異常哨查,不寫 except:pass 風(fēng)格的代碼)
當(dāng)存在多種可能,不要嘗試去猜測(cè)
而是盡量找一種剧辐,最好是唯一一種明顯的解決方案(如果不確定寒亥,就用窮舉法)
雖然這并不容易,因?yàn)槟悴皇?Python 之父(這里的 Dutch 是指 Guido )
做也許好過不做荧关,但不假思索就動(dòng)手還不如不做(動(dòng)手之前要細(xì)思量)
如果你無法向人描述你的方案溉奕,那肯定不是一個(gè)好方案;反之亦然(方案測(cè)評(píng)標(biāo)準(zhǔn))
命名空間是一種絕妙的理念忍啤,我們應(yīng)當(dāng)多加利用(倡導(dǎo)與號(hào)召)