在我的程序中,我想根据用户所使用的操作系统是Windows还是Linux来导入simplejson或json.我将操作系统名称作为用户的输入.现在,执行以下操作是否正确?
osys = raw_input("Press w for windows,l for linux")
if (osys == "w"):
import json as simplejson
else:
import simplejson
Run Code Online (Sandbox Code Playgroud) python ×1