1. 程式人生 > >TypeError: 'bytes' object is not callable 解決方法

TypeError: 'bytes' object is not callable 解決方法

原始碼如下,定義的本地變數get_time和get_time()外部引入方法重名,呼叫get_time(),被當成了本地變數get_time= b'\d+

.\d+',變數不可被呼叫(函式才可呼叫)。

if __name__ == '__main__':

	get_time= b'\d+\.\d+'
	path=input("輸入要分割檔案的路徑:")
	count,time = get_time(path,get_time)
	print("直流開關機次數:",count,"\t 開機時長:", time)