-3

I am a python 2 user on windows 7 and i want to use python 2 features in python 3 code for a assignment as i am not that familiar with python 3.

Could you please suggest any python 3 module which can help me use python 2 code in python 3. just tell me a name for the module. I will figure out how to use it.

Thank's in advance!

huzefausama
  • 432
  • 1
  • 6
  • 22
  • 2
    What features do you want to use that you do not have access with in python 3? – Axe319 May 13 '20 at 10:05
  • Also, asking for a module name or software library is defined as off topic for stack overflow. https://stackoverflow.com/help/on-topic – Axe319 May 13 '20 at 10:09
  • 1
    It would be in your best interest to get familiar with Python 3. Python 2 is deprecated and no longer supported. For the most part the two languages are the same. There are only a handful of "features" in Python 2 that are not supported in Python 3 (old-style `str`, print statement, cmp function, etc.). – Iguananaut May 13 '20 at 11:00
  • @Axe319 , Actually I want to do the opposite of this . My school computers have Python 2 installed. I want to use features like f-strings in python 2 . Is it possible? – Jdeep Jul 10 '20 at 15:22
  • @NoahJ.Standerson see https://stackoverflow.com/questions/42097052/can-i-import-pythons-3-6s-formatted-string-literals-f-strings-into-older-3-x – Axe319 Jul 10 '20 at 17:03

1 Answers1

1

You have a choice between two tools in porting your code automatically: Futurize and Modernize. Which tool you choose will depend on how you want your code to be. Futurize does its best to make Python 3 idioms and practices exist in Python 2, e.g. backporting the bytes type from Python 3 so that you have semantic parity between the major versions of Python. Modernize, on the other hand, is more conservative and targets a Python 2/3 subset of Python, directly relying on six to help provide compatibility. As Python 3 is the future, it might be best to consider Futurize to begin adjusting to any new practices that Python 3 introduces which you are not accustomed to yet