You can create a constant name file with a constant variable but it is not truly Constant File because there is no strict concept of constant variables like in other languages in Python.
Python constants file example
A simple example code creates
constant.py a Python file that contains only constants and then imports them into your
PI = 3.14159
GRAVITY = 9.81
SPEED_OF_LIGHT = 299792458
print(constants.PI) # 3.14159
print(constants.GRAVITY) # 9.81
print(constants.SPEED_OF_LIGHT) # 299792458
Do comment if you have any doubts or suggestions on this Python constant topic.
Note: IDE: PyCharm 2021.3.3 (Community Edition)
All Python Examples are in Python 3, so Maybe its different from python 2 or upgraded versions.
Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.