2017-12-13 1 views
-9

したがって、time.sleepは機能しません。私はPython 3.4.3で、私は3.6で私のコンピュータ上でこの問題を抱えていません。Time.sleep()エラー

これは私のコードです:

import calendar 
import time 
def ProfileCreation(): 
    Name = input("Name: ") 
    print("LOADING...") 
    time.sleep(1) 
    Age = input("Age: ") 
    print("LOADING...") 
    time.sleep(1) 
    ProfileAns = input("This matches no profiles. Create profile? ") 
    if ProfileAns.lower == 'yes': 
     print("Creating profile...") 
    elif ProfileAns.lower == 'no': 
     print("Creating profile anyway...") 
    else: 
     print("yes or no answer.") 
     ProfileCreation() 
ProfileCreation() 
+6

あなたは時間をインポートする必要があります – mast3rd3mon

答えて

0

が変更に。睡眠は時間パッケージの中です。あなたが実際に定義されていない瞬間time.sleep(1)のようimport timeしたい場合があります 輸入カレンダー インポート時

def ProfileCreation(): 
    Name = input("Name: ") 
    print("LOADING...") 
    time.sleep(1) 
    Age = input("Age: ") 
    print("LOADING...") 
    time.sleep(1) 
    ProfileAns = input("This matches no profiles. Create profile? ") 
    if ProfileAns.lower == 'yes': 
     print("Creating profile...") 
    elif ProfileAns.lower == 'no': 
     print("Creating profile anyway...") 
    else: 
     print("yes or no answer.") 
     ProfileCreation() 
ProfileCreation() 
0

をあなたはまた、時間をインポートする必要があるカレンダーをインポートしたあなたのimport文では、次の

import calendar 

def ProfileCreation(): 
    Name = input("Name: ") 
    print("LOADING...") 
    time.sleep(1) 
    Age = input("Age: ") 
    print("LOADING...") 
    time.sleep(1) 
    ProfileAns = input("This matches no profiles. Create profile? ") 
    if ProfileAns.lower == 'yes': 
     print("Creating profile...") 
    elif ProfileAns.lower == 'no': 
     print("Creating profile anyway...") 
    else: 
     print("yes or no answer.") 
     ProfileCreation() 
ProfileCreation() 
2

は、ちょうどあなたのコードの先頭にインポートを追加し、これはそれを修正する必要があります。

関連する問題