だから私は、私はそれを実行するためのプログラムにかかる時間を記録するために時間を使っていて、ファイルが一定の年齢以上のものですので、もし私が日付を確認する必要が日時と時刻は同じプログラムで使用できません。
import datetime
import time
でプログラムを書いています処理しないでください。
は私が
Traceback (most recent call last):
File "<stdin>", line 563, in <module>
File "<stdin>", line 498, in main
AttributeError: type object 'datetime.time' has no attribute 'time'
shell returned 1
が、一つのプログラムで両方の時間と日時を使用することはできませんこれらの2つのクラスを使用しようとすると、このエラーを得続けますか?
コードの一部:ここ
import PyPDF2
import re
import os
#Time testing
import time
#Using this to check if address is in proper format and to clean it up
import usaddress
#testing this one out
import datetime
from dateutil.parser import *
from dateutil.tz import *
from datetime import *
#Timer starts
start_time = time.time() #Error is referring to this line, line 498
#Opens 3 different files
#For file in folder parse it to text
#Writes some things to file
#Gets the date from the file
if date != None:
fileDate = parse(date).year
now = datetime.now()
print now.year, now.month, now.day
#Ends the timer and prints the time to the console
print("--- %s seconds ---" % round(time.time() - start_time, 2))
。両方を使うことはまったく問題ありません。両方をインポートして、あなたのやり方で 'start_time'を設定しようとしました。あなたはどこかの方法を上書きしたかもしれませんか? – Petar
@ペタル私は私がしなかったと確信しています。他のモジュールがメソッドを上書きすることができないかぎり? – SPYBUG96
[Minimal、Complete、and Verifiable Example](http://stackoverflow.com/help/mcve)を投稿すると、デバッグがずっと簡単になります。 – DavidG