先看代码:
import time #利用importprint "how",time.sleep(2) #sleep()方法前面必须得有导入模块的名字timeprint "are",time.sleep(2)print "you",time.sleep(2)print "today?"from time import sleep #利用from...import...print "how",sleep(2) #sleep()方法前面就不要有导入模块的名字了print "are",sleep(2)print "you",sleep(2)print "today?"结果how are you today?how are you today?
区别我在代码中的注释部分已经写出了。