跳去導覽 跳去搵嘢
設計者Guido van Rossum
第一次出現1991年, 31年之前 (1991)[1]
3.11.0[2] 喺維基數據度改 / 2022年10月24號,39日之前
3.12.0a2[3] 喺維基數據度改 / 2022年11月15號,17日之前
類型系統鴨子類型動態強類型[4]漸進英文gradual typing(自從3.5)[5]
網站 改維基數據
Major implementations
CPythonPyPyIronPythonJythonStackless PythonMicroPythonCircuitPython英文CircuitPython、RustPython[8]
CythonRPythonStarlark英文Bazel (software)[9]
ABC[10]Ada[11]ALGOL 68[12]APL[13]C[14]C++[15]CLU[16]Dylan[17]Haskell[18]Icon[19]Java[20]Lisp[21]Modula-3[15]PerlStandard ML[13]
BooCobra英文Cobra (programming language)CoffeeScript[22]DF#FalconGenie[23]GoGroovyJavaScript[24][25]Julia[26]Nim、Ring[27]Ruby[28]Swift[29]

Python英國發音:/ˈpaɪθən/ 美國發音:/ˈpaɪθɑːn/),係一種直譯高階程式語言,係1991 年由吉多·范羅蘇姆始創[30],特徵係啲編碼嘅可讀性高,而且會多用空格(即係跟越位法則),支援多種嘅編程範式,包括結構化編程物件導向編程,而且有個全面嘅標準庫[31]。因為呢啲緣故,Python 喺廿一世紀初俾人廣泛採用嚟做好多種唔同嘅編程作業,例如係編寫機械學習程式同電子遊戲程式[32]



Python 呢種程式語言跟越位法則(off-side rule),即係話縮進會用嚟表示「邊幾行碼屬同一個碼塊」嘅資訊。



  • 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




  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 3.11 Released With Big Performance Improvements, Task Groups For Async I/O" (英文). 2022年10月24號. 喺2022年10月25號搵到.
  3. "Python 3.12.0 alpha 2 released" (英文). 2022年11月15號. 喺2022年11月16號搵到.
  4. "Why is Python a dynamic language and also a strongly typed language - Python Wiki". 喺2021-01-27搵到.
  5. "PEP 483 -- The Theory of Type Hints". 原先內容歸檔喺2020-06-14. 喺2020-04-22搵到.
  6. File extension .pyo was removed in Python 3.5. See PEP 0488 互聯網檔案館歸檔,歸檔日期2020年6月1號,.
  7. Holth, Moore (2014-03-30). "PEP 0441 -- Improving Python ZIP Application Support". 原先內容歸檔喺2018-12-26. 喺2015-11-12搵到.
  8. "RustPython".
  9. "Starlark Language". 喺25 May 2019搵到.
  10. 引用錯誤 無效嘅<ref>標籤;無文字提供畀叫做faq-created嘅參照
  11. "Ada 83 Reference Manual (raise statement)".
  12. Kuchling, Andrew M. (22 December 2006). "Interview with Guido van Rossum (July 1998)". 原著喺1 May 2007歸檔. 喺12 March 2012搵到.
  13. 13.0 13.1 "itertools — Functions creating iterators for efficient looping — Python 3.7.1 documentation".
  14. 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)
  15. 15.0 15.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
  16. Lundh, Fredrik. "Call By Object". 原著喺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.
  17. 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)
  18. Kuchling, A. M. "Functional Programming HOWTO". Python v2.7.2 documentation. Python Software Foundation. 喺9 February 2012搵到.
  19. Schemenauer, Neil; Peters, Tim; Hetland, Magnus Lie (18 May 2001). "PEP 255 – Simple Generators". Python Enhancement Proposals. Python Software Foundation. 喺9 February 2012搵到. {{cite web}}: no-break space character in |title= at position 8 (help)
  20. 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); no-break space character in |title= at position 8 (help)
  21. "More Control Flow Tools". Python 3 documentation. Python Software Foundation. 喺24 July 2015搵到.
  22. "CoffeeScript".
  23. "The Genie Programming Language Tutorial". 喺28 February 2020搵到.
  24. "Perl and Python influences in JavaScript". 24 February 2013. 喺15 May 2015搵到.
  25. Rauschmayer, Axel. "Chapter 3: The Nature of JavaScript; Influences". O'Reilly, Speaking JavaScript. 原著喺2018年12月26號歸檔. 喺15 May 2015搵到.
  26. 引用錯誤 無效嘅<ref>標籤;無文字提供畀叫做Julia嘅參照
  27. Ring Team (4 December 2017). "Ring and other languages". ring-lang.
  28. 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.
  29. 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.
  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.