From b846732d1e64bf8b4afa4775056143df555754a9 Mon Sep 17 00:00:00 2001 From: m9henri Date: Thu, 26 Sep 2024 23:39:49 +0200 Subject: [PATCH] added writing to file --- .gitignore | 4 ++++ .vscode/launch.json | 2 +- ideas.txt | 4 ++-- start+tracker.py => main.py | 8 ++++++++ 4 files changed, 15 insertions(+), 3 deletions(-) rename start+tracker.py => main.py (78%) diff --git a/.gitignore b/.gitignore index 5a9ef4a..cb952ab 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ __pycache__/main.cpython-312.pyc __pycache__/MainTracker.cpython-312.pyc +build +dist +start+tracker.spec +ideas.txt \ No newline at end of file diff --git a/.vscode/launch.json b/.vscode/launch.json index 4a0ec9c..e0087c8 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -8,7 +8,7 @@ "name": "Python Debugger: Current File", "type": "debugpy", "request": "launch", - "program": "start+tracker.py", + "program": "main.py", "console": "externalTerminal" } ] diff --git a/ideas.txt b/ideas.txt index 0a6a3d6..8f89df5 100644 --- a/ideas.txt +++ b/ideas.txt @@ -1,7 +1,7 @@ open: - main tracker (transaction type, date, reason, how much) calculating from the tracker file - tracker.log converter done: + tracker.log + main tracker (transaction type, date, reason, how much) \ No newline at end of file diff --git a/start+tracker.py b/main.py similarity index 78% rename from start+tracker.py rename to main.py index 8925e1a..16e4def 100644 --- a/start+tracker.py +++ b/main.py @@ -17,6 +17,7 @@ def transaction(): final_answer = input() if final_answer == "Y": print("\nCongrats, you've made a change!") + writing(transaction_type, date, reason, heavyness) time.sleep(5) start() if final_answer == "n": @@ -25,6 +26,13 @@ def transaction(): transaction() return +def writing(transaction_type, date, reason, heavyness): + file = open("tracker.log", "a") + file.write(f"Date: {date}\n") + file.write(f"Reason: {reason}\n") + file.write(f"How much spent/got: {transaction_type}{heavyness}\n\n") + return + def start(): os.system("cls") print(