(Translated by https://www.hiragana.jp/)
Python - 維基百科,自由嘅百科全書 とべ內容

Python

出自しゅつじ維基百科ひゃっか自由じゆう百科全書ひゃっかぜんしょ
  提示ていじ呢篇ぶんこう嘅唔がかり蟒蛇うわばみ
Python
へんほど範式はんしきはんがた函數かんすうしき指令しれいしき反射はんしゃしき結構けっこう物件ぶっけんしるべむこう
設計せっけいしゃGuido van Rossum
へんほどいんPython軟件基金ききんかい
だいいち出現しゅつげん1991ねん, 33ねんまえ (1991)[1]
穩定版本はんぽん
3.12.4[2] 喺維基數據度改 / 2024ねん6がつ6ごう,44にちまえ
類型るいけい系統けいとうかも類型るいけい動態どうたいつよ類型るいけい[3]漸進ぜんしん英文えいぶんgradual typingしたがえ3.5)[4]
操作そうさ系統けいとうまたが平臺ひらだいWindowsLinux/UnixmacOSひとし
軟件授權Python軟件基金ききんかい許可きょかしょう
ふく檔名.py、.pyi、.pyc、.pyd、.pyo(3.5まえ[5]Template:Notatypo、.pyz(したがえ3.5)[6]
あみwww.python.org 改維基數據
Major implementations
CPythonPyPyIronPythonJythonStackless PythonMicroPythonCircuitPython英文えいぶんCircuitPython、RustPython[7]
Dialects
CythonRPythonStarlark英文えいぶんBazel (software)[8]
啟發けいはつげん
ABC[9]Ada[10]ALGOL 68[11]APL[12]C[13]C++[14]CLU[15]Dylan[16]Haskell[17]Icon[18]Java[19]Lisp[20]Modula-3[14]PerlStandard ML[12]
影響えいきょうげん
BooCobra英文えいぶんCobra (programming language)CoffeeScript[21]DF#FalconGenie[22]GoGroovyJavaScript[23][24]Julia[25]Nim、Ring[26]Ruby[27]Swift[28]

Python英國えいこく發音はつおん/ˈpaɪθしーたən/ 美國びくに發音はつおん/ˈpaɪθしーたɑːn/),かかりいちしゅ直譯ちょくやく高階たかしなほどしきげんゆかりらんけん機構きこう CWI(數學すうがく電腦でんのう科學かがく中心ちゅうしん)嘅 Guido van Rossum 設計せっけい,1991ねんくび推出[29][30]特徵とくちょうがかりへん可讀かどくせいだかそらかくゆう語義ごぎ所謂いわゆるえつ法則ほうそく)、支援しえん多種たしゅへんほど範式はんしき包括ほうかつ結構けっこうへんほどどう物件ぶっけんしるべむこうへんほど)、而且ゆう全面ぜんめん標準ひょうじゅん[31]よしため呢啲緣故えんこ,Python 喺廿一世紀初俾人廣泛採用嚟做好多種唔同嘅へんほど作業さぎょうれい如係へんうつし機械きかい學習がくしゅうほどしきどう電子でんし遊戲ゆうぎほどしき[32]。喺工程こうていがくどう科學かがくさかい常用じょうよう;喺財經ざいけいさかいまたみやこしげるため咗考CFAぱい以考嘅嘢[33]

語法ごほう

[編輯へんしゅう]

ちぢみすすむ

[編輯へんしゅう]

Python 呢種ほどしきげんえつ法則ほうそく(off-side rule),そくがかりばなしちぢみしんかいよう表示ひょうじあたりいくぎょう碼屬どういち碼塊」嘅資訊。

せきかぎ

[編輯へんしゅう]

Python ゆう35せきかぎまたさけべ保留ほりゅうそくがかり唔可以當識別しきべつよう):

  • and
  • as
  • assert
  • async
  • await
  • break
  • class
  • continue
  • def
  • del
  • elif
  • else
  • except
  • False
  • finally
  • for
  • from
  • global
  • if
  • import
  • in
  • is
  • lambda
  • None
  • nonlocal
  • not
  • or
  • pass
  • raise
  • return
  • True
  • try
  • while
  • with
  • yield

かずよりどころ結構けっこう

[編輯へんしゅう]
  • array[::]
  • zip(,)

ひかえせいりゅうほど

[編輯へんしゅう]

Python よう許多きょたしゅひかえせいりゅうほどこうのう包括ほうかつ

  • if... else
  • if...elif...else
  • for
  • while
  • try
  • print(...)
  • input("")
  • with open("...", " ") as ...

ほどじょ

[編輯へんしゅう]
  • def func1(*args):

運算うんざん

[編輯へんしゅう]
  • + あい
  • - そうげん
  • * 相乘そうじょう
  • / じょ
  • % すう

れい

[編輯へんしゅう]

以下いかかかり Python 嘅 Hello World だい碼,めいざい非常ひじょう簡單かんたん

print("Hello, world!")

以下いか呢段 python 碼會攞いちせい整數せいすうinputさい俾嗰個數こすうかいじょうoutput

n = int(input('Type a number, and its factorial will be printed: '))

if n < 0:
    raise ValueError('You must enter a positive integer')

fact = 1
i = 2
while i <= n:
    fact *= i
    i += 1

print(fact)
  1. Guttag, John V. (12 August 2016). Introduction to Computation and Programming Using Python: With Application to Understanding Data. MIT Press. ISBN 978-0-262-52962-4.
  2. "Python Insider: Python 3.12.4 released"; 出版しゅっぱん: 2024ねん6がつ6ごう; 檢索けんさく: 2024ねん6がつ7ごう.
  3. "Why is Python a dynamic language and also a strongly typed language - Python Wiki". wiki.python.org. 喺2021-01-27搵到.
  4. "PEP 483 -- The Theory of Type Hints". Python.org. はらさき內容かえり喺2020-06-14. 喺2020-04-22搵到.
  5. File extension .pyo was removed in Python 3.5. See PEP 0488 互聯もう檔案かんかえりかえり檔日2020ねん6がつ1ごう,.
  6. Holth, Moore (2014-03-30). "PEP 0441 -- Improving Python ZIP Application Support". はらさき內容かえり喺2018-12-26. 喺2015-11-12搵到.
  7. "RustPython".
  8. "Starlark Language". 喺25 May 2019搵到.
  9. 引用いんよう錯誤さくご 無效むこう<ref>しめぎくじ文字もじ提供ていきょう畀叫做faq-created參照さんしょう
  10. "Ada 83 Reference Manual (raise statement)".
  11. Kuchling, Andrew M. (22 December 2006). "Interview with Guido van Rossum (July 1998)". amk.ca. 原著げんちょ喺1 May 2007. 喺12 March 2012搵到.
  12. 12.0 12.1 "itertools — Functions creating iterators for efficient looping — Python 3.7.1 documentation". docs.python.org.
  13. van Rossum, Guido (1993). 1&type=pdf "An Introduction to Python for UNIX/C Programmers". Proceedings of the NLUUG Najaarsconferentie (Dutch UNIX Users Group). even though the design of C is far from ideal, its influence on Python is considerable. {{cite journal}}: Check |url= value (help)
  14. 14.0 14.1 "Classes". The Python Tutorial. Python Software Foundation. 喺20 February 2012搵到. It is a mixture of the class mechanisms found in C++ and Modula-3
  15. Lundh, Fredrik. "Call By Object". effbot.org. 原著げんちょ喺2019ねん11月23ごう. 喺21 November 2017搵到. replace "CLU" with "Python", "record" with "instance", and "procedure" with "function or method", and you get a pretty accurate description of Python's object model.
  16. Simionato, Michele. ses/2.3/mro/ "The Python 2.3 Method Resolution Order". Python Software Foundation. The C3 method itself has nothing to do with Python, since it was invented by people working on Dylan and it is described in a paper intended for lispers {{cite web}}: Check |url= value (help)CS1 maint: url-status (link)
  17. Kuchling, A. M. "Functional Programming HOWTO". Python v2.7.2 documentation. Python Software Foundation. 喺9 February 2012搵到.
  18. Schemenauer, Neil; Peters, Tim; Hetland, Magnus Lie (18 May 2001). "PEP 255 – Simple Generators". Python Enhancement Proposals. Python Software Foundation. 喺9 February 2012搵到.
  19. Smith, Kevin D.; Jewett, Jim J.; Montanaro, Skip; Baxter, Anthony (2 September 2004). 18/ "PEP 318 – Decorators for Functions and Methods". Python Enhancement Proposals. Python Software Foundation. 喺24 February 2012搵到. {{cite web}}: Check |url= value (help)
  20. "More Control Flow Tools". Python 3 documentation. Python Software Foundation. 喺24 July 2015搵到.
  21. "CoffeeScript". coffeescript.org.
  22. "The Genie Programming Language Tutorial". 喺28 February 2020搵到.
  23. "Perl and Python influences in JavaScript". www.2ality.com. 24 February 2013. 喺15 May 2015搵到.
  24. Rauschmayer, Axel. "Chapter 3: The Nature of JavaScript; Influences". O'Reilly, Speaking JavaScript. 原著げんちょ喺2018ねん12月26ごう. 喺15 May 2015搵到.
  25. 引用いんよう錯誤さくご 無效むこう<ref>しめぎくじ文字もじ提供ていきょう畀叫做Julia參照さんしょう
  26. Ring Team (4 December 2017). "Ring and other languages". ring-lang.net. ring-lang. 原著げんちょ喺2018ねん12月25ごう. 喺2022ねん4がつ5ごう搵到.
  27. Bini, Ola (2007). Practical JRuby on Rails Web 2.0 Projects: bringing Ruby on Rails to the Java platform. Berkeley: APress. p. 3. ISBN 978-1-59059-881-8.
  28. Lattner, Chris (3 June 2014). "Chris Lattner's Homepage". Chris Lattner. 喺3 June 2014搵到. The Swift la nguage is the product of tireless effort from a team of language experts, documentation gurus, compiler optimization ninjas, and an incredibly important internal dogfooding group who provided feedback to help refine and battle-test ideas. Of course, it also greatly benefited from the experiences hard-won by many other languages in the field, drawing ideas from Objective-C, Rust, Haskell, Ruby, Python, C#, CLU, and far too many others to list.
  29. "History and License — Python 3.11.2 documentation" (英文えいぶん). Python Software Foundation. 喺2023ねん2がつ20ごう搵到.
  30. "The History of Python: A Brief Timeline of Python". Blogger. 2009-01-20. 喺2016-03-20搵到.
  31. "About Python". Python Software Foundation. Retrieved 24 April 2012., second section "Fans of Python use the phrase "batteries included" to describe the standard library, which covers everything from asynchronous processing to zip files."
  32. Kuhlman, Dave. "A Python Book: Beginning Python, Advanced Python, and Python Exercises". Section 1.1.
  33. さわ (2023ねん3がつ19ごう). みず政府せいふ嘗試はさまUBSどうCredit Suisse合併がっぺい 投資とうし銀行ぎんこう部分ぶぶんただれいた朋友ほうゆうかいせっしゅ だいぎょう黃金おうごん時代じだいやめけい過去かこ かい事情じじょうしょうかい陸續りくぞくゆう. さわいくぶんかねひょうろん. 時間じかん 22:37. 喺2023ねん3がつ19ごう搵到.

參考さんこう

[編輯へんしゅう]