0x00 世界,你好

0x01 Python 哲學

Python 執行 import this 時,會列印出 Python 之禪,就是上面的一段英文,它是 Python 設計和應用的理念。下面是簡單的翻譯

0x02 Python 還能看漫畫

執行上面的命令後,Python 會開啟一個神奇的世界

啥,還自帶漫畫的。下面是從網上找的翻譯

0x03 不習慣 Python 的縮排怎麼辦
我們都知道 Python 的一大特點就是用縮排來管理程式碼塊,而很多語言比如 C/C++ 都是用花括號來管理程式碼塊的。所以 Python 也想到了這一點,試一試這行程式碼呢。

嘿嘿,你以為這樣就可以了。

打臉。這樣操作雖說語法是正確的,但你看它報的居然是語法錯誤。還調皮的說沒機會。這…
0x04 關於不等號的選擇
本節針對 Python 3 這個版本。
一般程式語言,如 C 、JAVA 等,我們不等號都習慣使用 != 。預設情況下,Python 也是這樣的。

但是當我們執行下面這個命令後

結果居然反過來了
這個時候 <> 符號居然正常工作,而 != 卻報錯了。
原來啊,有一個著名的 Python 開發者,他的外號是叫 FLUFL 。他覺得 ! 和 = 這兩個符號在鍵盤上隔得比較遠,而 < 和 > 這兩個鍵是挨著的,所以他希望 Python 3 中能支援 <> 的使用,所以就出現了上面的這個情況。
如果你之前學了 C 或者 JAVA 等語言,在看到 Python 的這些操作後,你可能有些措手不及,哈哈。不過,Python 就是這樣設計的,它追求的就是有趣以及有個性。
看了之後,是不是想動手試一試呢?趕緊搭上環境玩玩吧。說不定,你還能發現更有趣的東西。
歡迎大家關注,我會帶大家發現程式設計中更多有趣的東西! 原文:www.wukong.com/question/65…
