I want to write script with logic like below
if <script invoked by python3>:
do A
elif <script invoked by python2>:
do B
How can I achieve this?
I want to write script with logic like below
if <script invoked by python3>:
do A
elif <script invoked by python2>:
do B
How can I achieve this?
You are most likely after something similar to this (refer to original question and answer):
import sys
if sys.version_info.major >= 3:
# Python 3 code
else:
# Python 2 code