I have written code in Python. In the import section i have the following:
import snappy
import xlrd
The xlrd is a library that can only be used by Python 3.6.  The snappy is a libary that can only be used by Python 2.7. How i can use both Python 2.7 and 3.6?
Sadly you can't, you have to use a compatible version of the library you need.
You can use python-snappy
Import from various version of python