前提・実現したいこと
4つのinput()があり、全ての入力結果をまとめてリストlistings[]に入れています。
その後、CSVにlistings[]のデータを書き込みしたいのですが、ひとつのセルに表示されません。
発生している問題・エラーメッセージ
該当のソースコード
listings = [] keepAsking = True while keepAsking: inputCheck = True while inputCheck: choice = input("A or B: ") if choice == "A": aProcess = True while aProcess: food = input("Food: ") drink = input("Drink: ") place = input("Place: ") number = input("Number: ") listing = food + " (" + drink + ") - " + place + ", " + number + "." listings.append(listing) aProcess = False inputCheck = False elif choice == "B": with open("data.csv", "a") as file: file.write("\n".join(listings) + "\n") inputCheck = False
補足情報(FW/ツールのバージョンなど)
python3.8.2
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/05/07 06:58