Reputation: 11
Hello there i need some help for a little, i working on python version 3/2, i wanna create a system detection on python script and how can i solve the problem like this:
try:
import platform
python_sysvers = platform.python_version()
if (self.linux_prompt()):
if int(python_sysvers[0]) == True:
command = input("")
else:
if (self.linux_prompt()):
if int(python_sysvers[0]) == True:
return input(self.getlinux_prompt())
while True:
if command == 'terminate':
if 'terminate' in command:
self.quit = True
return
self.sock.send(command)
ok from the code i wrote above i aim to call "raw_input()" if it is python version 2 but if it is in higher version the function refer to "input()" function then how to make it when we run the code it either uses python version 2 or version 3 the code can run compatible and if I run the code with python version 3 it doesn't get transferred to python version 2 code, ... the above code is intended to be easier to maintain thank you ^^
solve how to calling python 2 codes on python 3
Upvotes: 0
Views: 61