饺影 发表于 2022-7-11 17:35:12

python出错

import threading,time
def run(n):
    print("hello,world",n)
    time.sleep(1)

start_time = time.time
t1 = threading.Thread(target=run,args=("1",))
t2 = threading.Thread(target=run,args=("2",))

t1.start()
t2.start()
t1.join()
t2.join()
print(time.time()-start_time)
i = input(">")

报错是:
Traceback (most recent call last):
File "I:\lomen cmd import\temp\1.py", line 14, in <module>
    print(time.time()-start_time)
TypeError: unsupported operand type(s) for -: 'float' and 'builtin_function_or_method'

qq1151985918 发表于 2022-7-11 17:37:05

第6行加个括号time.time()

饺影 发表于 2022-7-13 12:27:40

qq1151985918 发表于 2022-7-11 17:37
第6行加个括号time.time()

ok,谢谢
页: [1]
查看完整版本: python出错