Best way to import version-specific python modules

前端 未结 2 1936
难免孤独
难免孤独 2021-02-05 16:19

Which method makes the most sense for importing a module in python that is version specific? My use case is that I\'m writing code that will be deployed into a python 2.3 enviro

2条回答
  •  庸人自扰
    2021-02-05 16:43

    I would probably argue that the second one would be preferable. Sometimes, you can install a module from a newer version of python into an older one. For example, wsgiref comes with Python 2.5, but it isn't entirely uncommon for it to be installed into older versions (I think it will work with python 2.3 up).

提交回复
热议问题