Python基礎(chǔ)學(xué)習(xí)之Python簡介
Python 簡介Python歷史Python的創(chuàng)始人為荷蘭人吉多·范羅蘇姆Guido van Rossum。1989年的圣誕節(jié)期間吉多·范羅蘇姆為了在阿姆斯特丹打發(fā)時間決心開發(fā)一個新的腳本解釋程序作為 ABC 語言的一種繼承。之所以選中Python作為程序的名字是因為他是 BBC 電視劇——蒙提·派森的飛行馬戲團(tuán)Monty Pythons Flying Circus的愛好者。1991年第一個 Python 編譯器誕生。它是用C語言實現(xiàn)的并能夠調(diào)用C語言的庫文件。Python 2.0于 2000 年 10 月 16 日發(fā)布增加了實現(xiàn)完整的垃圾回收并且支持Unicode。Python 3.0于 2008 年 12 月 3 日發(fā)布此版不完全兼容之前的Python源代碼。不過很多新特性后來也被移植到舊的Python 2.6/2.7版本。第一行Python代碼安裝好Python之后在命令行下輸入python就可以進(jìn)入Python解釋器的頁面。按照慣例第一行代碼應(yīng)該是輸出hello world!printhello world!hello world!相對與JavaC等語言Python僅僅使用一行語句就完成的了這個任務(wù)??梢詫⑦@句話的內(nèi)容保存到一個文本文件中并使用后綴名.py結(jié)尾例如hello_world.py在命令行下運行這個程序python hello_world.py也會輸出hello world!的結(jié)果。Python 之禪在Python解釋器下輸入import this會出來這樣一首小詩importthisThe 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 arent 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 youre Dutch. Now is better than never. Although never is often better than *right* now. If the implementation is hard to explain, its a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- lets do more of those!這首詩反映了Python的設(shè)計哲學(xué)——Python是一種追求優(yōu)雅明確簡單的編程語言但事實上產(chǎn)生這首詩的代碼并沒有寫的那么簡單易懂sGur Mra bs Clguba, ol Gvz Crgref Ornhgvshy vf orggre guna htyl. Rkcyvpvg vf orggre guna vzcyvpvg. Fvzcyr vf orggre guna pbzcyrk. Pbzcyrk vf orggre guna pbzcyvpngrq. Syng vf orggre guna arfgrq. Fcnefr vf orggre guna qrafr. Ernqnovyvgl pbhagf. Fcrpvny pnfrf nerag fcrpvny rabhtu gb oernx gur ehyrf. Nygubhtu cenpgvpnyvgl orngf chevgl. Reebef fubhyq arire cnff fvyragyl. Hayrff rkcyvpvgyl fvyraprq. Va gur snpr bs nzovthvgl, ershfr gur grzcgngvba gb thrff. Gurer fubhyq or bar-- naq cersrenoyl bayl bar --boivbhf jnl gb qb vg. Nygubhtu gung jnl znl abg or boivbhf ng svefg hayrff lbher Qhgpu. Abj vf orggre guna arire. Nygubhtu arire vf bsgra orggre guna *evtug* abj. Vs gur vzcyrzragngvba vf uneq gb rkcynva, vgf n onq vqrn. Vs gur vzcyrzragngvba vf rnfl gb rkcynva, vg znl or n tbbq vqrn. Anzrfcnprf ner bar ubaxvat terng vqrn -- yrgf qb zber bs gubfr!d{}forcin(65,97):foriinrange(26):d[chr(ic)]chr((i13)%26c)print.join([d.get(c,c)forcins])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 arent 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 youre Dutch. Now is better than never. Although never is often better than *right* now. If the implementation is hard to explain, its a bad idea. If the implementation is easy to explain, it may be a good idea. Namespaces are one honking great idea -- lets do more of those!Life is short. Use Python.

相關(guān)新聞

RSA加密-django

RSA加密-django

1.安裝Crypto 2.生成公鑰與私鑰 #將公鑰與私鑰寫入settings.py文件中,一定注意格式不能變 RAS加密秘鑰 RSA_PUBLIC_KEY = -----BEGIN PUBLIC KEY----- MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC0VUm4Db5Rnvk35W+AqchafPBZ +ll3I3sFdsMGYo5NkD95W9pUh8NEbP6AtOdnqtPDHmfYwxzu…

2026/7/28 19:18:31 閱讀更多
第15章_HarmonyOs開發(fā)圖解之 相機

第15章_HarmonyOs開發(fā)圖解之 相機

第15章 HarmonyOs開發(fā)圖解之 相機HarmonyOS 學(xué)習(xí)系統(tǒng) | 階段三:高級深耕期學(xué)習(xí)目標(biāo)序號能力1掌握 HarmonyOS 相機開發(fā)的核心流程(獲取設(shè)備 -> 配置 -> 預(yù)覽 -> 拍照)2理解 CameraKit、Camera、FrameConfig 三層架構(gòu)3能夠?qū)崿F(xiàn)預(yù)覽、拍…

2026/7/28 19:18:31 閱讀更多
Python中文文本分析實戰(zhàn):從酒店評價挖掘商業(yè)洞察

Python中文文本分析實戰(zhàn):從酒店評價挖掘商業(yè)洞察

1. 項目概述:從酒店評價中挖掘商業(yè)洞察最近在復(fù)盤一個挺有意思的數(shù)據(jù)分析小項目,核心任務(wù)是對一堆酒店評價文本進(jìn)行挖掘。這活兒聽起來簡單,不就是看看用戶說了啥嘛,但真做起來,從數(shù)據(jù)清洗到得出有商業(yè)價值的結(jié)論&…

2026/7/29 3:36:01 閱讀更多
主流 JDK 發(fā)行版 的詳細(xì)對比

主流 JDK 發(fā)行版 的詳細(xì)對比

一、基礎(chǔ)關(guān)系圖 OpenJDK(開源上游)│├── Oracle JDK(商業(yè)發(fā)行版,基于 OpenJDK 閉源增強)├── Eclipse Temurin(社區(qū)中立,TCK 認(rèn)證,廣泛兼容)├── Amazon Corrett…

2026/7/29 3:26:01 閱讀更多
面試官大笑:“一個任務(wù)拆給 5 個 Subagent 并行跑,不比 1 個快 5 倍?“我搖頭:“快不了,還可能更慢“

面試官大笑:“一個任務(wù)拆給 5 個 Subagent 并行跑,不比 1 個快 5 倍?“我搖頭:“快不了,還可能更慢“

前兩個月,我在重構(gòu) AlgoMooc 網(wǎng)站過程中,發(fā)現(xiàn)一個問題:在 Claude Code 里把一個任務(wù)拆給 5 個 Subagent 并行跑,結(jié)果可能比 1 個 agent 從頭干到尾還慢? 大多數(shù)人的第一反應(yīng)是反過來的:活是并行干的&#…

2026/7/29 0:15:24 閱讀更多
# 鴻蒙 HarmonyOS 應(yīng)用開發(fā)實戰(zhàn)(第25期)|骰子(Dice Roller)— Unicode 符號與動畫渲染精講

# 鴻蒙 HarmonyOS 應(yīng)用開發(fā)實戰(zhàn)(第25期)|骰子(Dice Roller)— Unicode 符號與動畫渲染精講

一、應(yīng)用概述 骰子(Dice Roller) 是一款經(jīng)典的休閑娛樂應(yīng)用,模擬了真實擲骰子的過程。應(yīng)用投擲兩個骰子(六面標(biāo)準(zhǔn)骰),使用 Unicode 骰面符號直觀展示每個骰子的點數(shù),并伴有快速滾動的動畫效果?!?/p>

2026/7/29 0:15:24 閱讀更多