0
def optionFour(self):
if self == 4:
inFile = open('dates.csv', 'r')
for line in inFile:
gFile = line.strip()
gFile = gFile.split(',')
occurence = gFile[0]
month = int(gFile[1])
day = int(gFile[2])
year = int(gFile[3])
time = gFile[4]
event = gFile[5]
dates = [month, day, year]
day5 = int(input('Enter a day:'))
month5 = int(input('Enter a month:'))
year5 = int(input('Enter a year:'))
dateSelected = [month5, day5, year5]
if dates == dateSelected:
return str((occurence, ' appointment starting on (', dateSelected, '): ', time, ', ', event))
else:
return str('Nothing')
break
inFile.close()
これは入力ファイルの最初の行だけです最初の行だけをチェックしているだけです。入力ファイルの最初の行のみを処理する
'return'は関数を返します。' return'、あなたは 'continue'を使いたくないのですか? –
はい、それはPedro Lobitoが言う通りです。この質問には投票しませんが、削除してください。また、質問をする前にコードフローを確認してください。 –
最初の反復で関数は 'return'になります。 'return'の後にあなたは関数を終了します。 – Sklert