Reputation: 556
In higher versions of python i can do:
isinstance(s_out, bytes)
There is no 'bytes' in python2.4. Is there an equivalent of doing this in python2.4 which also works for all other python versions?
Upvotes: 0
Views: 94
Reputation: 5630
import sys
if sys.version_info < (2, 7):
bytes = str
if isinstance(s_out, bytes):
I really don't know the context but wouldn't it better to upgrade at least to python 2.7 and not lose time trying to make code python 2.4 compatible.
I do not know the target systems and the OS, but could imagine that it is possible to install a more recent python and invest the time to make the code work with newer pythons.
Upvotes: 2