工業製造
産業用モノのインターネット | 工業材料 | 機器のメンテナンスと修理 | 産業プログラミング |
home  MfgRobots >> 工業製造 >  >> Industrial programming >> Python

コードで Python のバージョンを確認する:最小値を要求する

コード内の Python のバージョンを確認して、ユーザーは互換性のないバージョンでスクリプトを実行していません。この簡単なチェックを使用してください:

import sys

if not sys.version_info > (2, 7):
   # berate your user for running a 10 year
   # python version
elif not sys.version_info >= (3, 5):
   # Kindly tell your user (s)he needs to upgrade
   # because you're using 3.5 features

Python

  1. Python データ型
  2. Python 演算子
  3. Python pass ステートメント
  4. Python 関数の引数
  5. Python 辞書
  6. Python イテレータ
  7. Python クロージャー
  8. Python 日時
  9. Pythonスリープ()
  10. Python の For &While ループ:列挙、中断、継続ステートメント
  11. Python time.sleep():コードに遅延を追加する (例)