Message395583
from importlib import util
mathmodule = util.find_spec("math")
math1 = util.module_from_spec(mathmodule)
print(math1.pi)
=====
$ python3.8 /tmp/foo.py
3.141592653589793
$ python3.9 /tmp/foo.py
Traceback (most recent call last):
File "/tmp/foo.py", line 5, in <module>
print(math1.pi)
AttributeError: module 'math' has no attribute 'pi' |
|
Date |
User |
Action |
Args |
2021-06-10 22:45:59 | prescod2 | set | recipients:
+ prescod2 |
2021-06-10 22:45:59 | prescod2 | set | messageid: <1623365159.13.0.132987664597.issue44386@roundup.psfhosted.org> |
2021-06-10 22:45:59 | prescod2 | link | issue44386 messages |
2021-06-10 22:45:59 | prescod2 | create | |
|