How to use python2 module in python3? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to use python2 module in python3?

i found a module package that is written in python 2.7 and don't support python3. how can i use it in python3? is there any middle module to use the original code yet? or i should convert all package codes from py2 to py3?

6th Apr 2018, 7:34 PM
farhax
3 Answers
+ 2
Is your project already written in Python 3? If it isn't, you should consider using Python 2.7 with __future__ imports, or trying another library. You could convert all to Python 3, and you would have to store the library code in your project, or make a script to adapt the library automatically, or yet making your Own module on PIP. I don't think of them as good ideas.
6th Apr 2018, 7:50 PM
Maicon Mauricio
Maicon Mauricio - avatar
+ 2
You're always welcome. Cool you're considering my idea :)
7th Apr 2018, 9:31 PM
Maicon Mauricio
Maicon Mauricio - avatar
+ 1
thanks maicon i afraid of converting the library and miss some features. i think your first idea is better one.
7th Apr 2018, 4:36 AM
farhax