为了测试,我写了一个程序,打印出时差,结果非常完美。这是密码测试.py在
import time
start = time.time()
while True:
if time.time() - start >= 59:
print(time.time() - start)
start = time.time()
正如我所说的,它在这里工作;但是当我将相同的代码复制到主代码中时主.py,它抛出这个错误
^{pr2}$为什么它能在我的终端上工作测试.py但却犯了个错误主.py我甚至不导入日期时间?在
我已经在网上搜索原因,但什么也没有,我需要使用我的代码主.py. 这是我的主.py公司名称:
import win32com.client #pip install pywin32 if not installed
import math
import time
import PySimpleGUI as sg
import pygame as pg
from pywintypes import com_error
x = math.inf
counter = 0
start=time.time()
while True:
print(start)
if time.time() - start >= 59:
counter = 0
start = time.time()
counter +=1
print(counter)
使用
import time as t
:输出:
^{pr2}$相关问题 更多 >
编程相关推荐