Can I detect if my code is running on cPython or Jython?

后端 未结 5 1000
伪装坚强ぢ
伪装坚强ぢ 2020-12-07 00:49

I\'m working on a small django project that will be deployed in a servlet container later. But development is much faster if I work with cPython instead of Jython. So what I

5条回答
  •  旧巷少年郎
    2020-12-07 01:37

    The most clear-cut way is:

    import platform

    platform.python_implementation()

    'CPython'

    By default, most of the time the underlying interpreter is CPython only which is also arguably the most efficient one :)

提交回复
热议问题