日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

XiaoKL学Python(C)__future__

發布時間:2023/12/10 python 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 XiaoKL学Python(C)__future__ 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

__future__ in Python

?

1. from __future__ import xxxx

這是為了在低版本的python中使用可能在某個高版本python中成為語言標準的特性,從而

在將代碼由低版本遷移到高版本的過程中,減少需要做的工作。

這種語句被稱為?future_statement?

2. future_statement的語法定義: Ref[2]


future_statement: "from" "__future__" "import" feature ["as" name]("," feature ["as" name])*feature: identifiername: identifier

3. 使用future_statement的注意事項

?


?

Reference

1.?What is __future__ in Python used for and how/when to use it, and how it works

http://stackoverflow.com/questions/7075082/what-is-future-in-python-used-for-and-how-when-to-use-it-and-how-it-works

2.?PEP 236 - PEP 236 -- Back to the __future__

https://www.python.org/dev/peps/pep-0236/

3.?28.11.?__future__?— Future statement definitions

https://docs.python.org/2/library/__future__.html

4.?Supporting Python?2 and 3 without 2to3 conversion

http://python3porting.com/noconv.html ?(Porting to Python 3)

http://pypi.python.org/pypi/six

5.?http://python-future.org/imports.html (To Read)

包括以下內容:?

  • absolute_import:?PEP 328: Imports: Multi-Line and Absolute/Relative
  • division:?PEP 238: Changing the Division Operator
  • print_function:?PEP 3105: Make print a function
  • unicode_literals:?PEP 3112: Bytes literals in Python 3000

轉載于:https://www.cnblogs.com/cwgk/p/4446090.html

總結

以上是生活随笔為你收集整理的XiaoKL学Python(C)__future__的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。