Enforce a Minimum Python Version in Your Script
You can check for the Python version in your code, to make sure your users are not running your script with an incompatible version. Use this simple check:
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
- Mastering Python Operators: A Comprehensive Guide
- Python List Operations: Creation, Access, Modification, and Advanced Techniques
- Mastering Python Tuples: Creation, Access, and Advanced Operations
- Mastering Python Dictionaries: Creation, Manipulation, and Advanced Techniques
- Master Python Loops: For, While, Break, Continue, and Enumerate Explained
- Python time.sleep(): How to Add Delays in Your Code (Example)
- Checking File and Directory Existence in Python – A Practical Guide
- Master Python Attrs: Build Advanced Data Classes with Practical Examples
- Efficiently Measure Python Object Memory Usage with sys.getsizeof()
- TV Check – CNC Dictionary Definition and Parity Explanation