r/PythonLearning • u/v1bonoxd • Sep 27 '26
read and write csv file
just learned about functions so tried it out with csv editing
4
u/silvertank00 Sep 27 '26
try to follow conventions, first uppercase letter in a word is reserved for classes and shouldnt be used in filenames.
For further info, discuss pep8
Edit: also in WriteIn, the fields list is redundant. csv.DictWriter(f, fieldnames=row.keys()) does the same whilst being DRY.
1
1
u/TreatZealousideal770 Sep 27 '26
Just a quick tip: on the first screenshot, you are calling the functions as automation.Reading(). If this code is inside the automation.py file itself, you don't need the automation. prefix. You can just call Reading() and WriteIn() directly. Keep it up
1
2


•
u/Sea-Ad7805 Sep 27 '26
Run this program by clicking Memory Graph Web Debugger and see its state change step by step.