In my program I want to import simplejson or json based on whether the OS the user is on is Windows or Linux. I take the OS name as input from the user. Now, is it correct t
I've seen this idiom used a lot, so you don't even have to do OS sniffing:
try: import json except ImportError: import simplejson as json