我有一个模块(tqdm),我需要导入不同,这取决于我是.ipynb在jupyter笔记本或jupyter实验室环境中运行我.有没有办法在python中确定这个?例如:
if <jupyter notebook>:
from tqdm import tqdm_notebook as tqdm
elif <jupyter lab>:
from tqdm import tqdm
else:
print("Not in jupyter environment.")
Run Code Online (Sandbox Code Playgroud)