这是给我带来麻烦的代码:
import time
from time import time
time.sleep(1)
start=time()
input=raw_input(' ')
end=time()
time.sleep(1)
print (start - end)
Run Code Online (Sandbox Code Playgroud)
问题是以下两个同名的导入time:
import time
from time import time
Run Code Online (Sandbox Code Playgroud)
如何在我的代码中访问这两个模块?我需要在我的代码中同时使用以下两行:
lines time()
and time.sleep()
Run Code Online (Sandbox Code Playgroud)
但是一旦导入,第二个模块就会覆盖第一个模块。
例如,我有这个变量:
x=123
Run Code Online (Sandbox Code Playgroud)
如何将它转换为元组或每个数字转换为单独的变量?:
x=(1,2,3)
Run Code Online (Sandbox Code Playgroud)
要么
x1=1
x2=2
x3=3
Run Code Online (Sandbox Code Playgroud)