|
本帖最后由 greenapl1985 于 2018-6-20 22:27 编辑
为什么import xxx,会直接运行该模块呢?
- x = "There are {0} types of people.\n".format(10)
- binary = "binary"
- do_not = "don't"
- y = "Those who know {0} and those who {1}".format(binary,do_not)
- print(x+y)
- print("I said: {0}".format(x))
- print("I also said: {0}".format(y))
- hilarious = False
- joke_evaluation = "Isn't that joke so funny ? {0}"
- print (joke_evaluation.format(hilarious))
复制代码 直接在c**ole里Import ex6,会打印出图片的内容,为什么会直接运行呢
但直接print (x)又会报错,此时x不是已经被导入了吗
>>>print (x)
Traceback (most recent call last):
File "<input>", line 1, in <module>
NameError: name 'x' is not defined
|
|