📜  如何检查用户是否正在使用主文件或导入文件并在 python 代码示例中使用

📅  最后修改于: 2022-03-11 14:46:31.495000             🧑  作者: Mango

代码示例2
def calculate_adding(num1,num2):
    return num1 + num2
if __name__ == '__main__':
    print("Hi you are using editor not importing")
    print(calculate_adding(90,10))
if __name__ != '__main__':
    print("You are importing me and using me")
#output
'''
Hi you are using editor not importing
100
'''