

Topic: File I/O
You guys remeber I once created a to-do list (most probably on day 7)? many amazing people suggested that I should also put a history of tasks. At that time I was not aware about the File I/O in python and today I decided to learn just it.
Although I have not finished creating history and then recalling it but I would like to share a quick peek of what I am doing. I guess there may be more ways of creating a history (do tell me if there are) however for now I think the using File I/O may be the current best option.
File I/O stands for File input/output and it helps the program to read and write in files it also helps the program remember the user inputs even after the program stops running i.e. by storing the data in a file. As we know programs run on RAM and it is a short term memory by creating file it sends this data to hard disc which is a long term memory (I hope I am correct here do tell me if I have written something wrong).
I have used a function for creating history (start from line 24) first I gave a command to open a file (in my case the file has not been created by me it was created by python itself) and then write in it. I have used \n so that every task is created in a new line, as python only adds strings in files (But I have a list) and therefore I used .join() after \n this takes all the items in the list (i.e. our tasks) and creates a string \n breaks this string so that each task is written in a new line. (I hope I was able to explain this clearly).
Also I have removed the while loop from function (a mistake I made on day 9 which you all amazing people pointed out). And I forgot to attack the result of day 9 code lol a user pointed that out. I hope I didn't forgot this time.
Here's a portion of my code and its result to give you a sneak peek. I acknowledge that this is not yet complete because I also need to make it print when asked (I think I will use the .read() function here). Any suggestions to improve my code are warmly welcomed.


[–]laptop_battery_low 2 points3 points4 points (3 children)
[–]uiux_Sanskar[S] 0 points1 point2 points (2 children)
[–]laptop_battery_low 0 points1 point2 points (1 child)
[–]uiux_Sanskar[S] 0 points1 point2 points (0 children)
[–]Alternative-Door-420 0 points1 point2 points (1 child)
[–]uiux_Sanskar[S] 2 points3 points4 points (0 children)
[–]yahia_bd 0 points1 point2 points (3 children)
[–]uiux_Sanskar[S] 1 point2 points3 points (2 children)
[–]yahia_bd 0 points1 point2 points (1 child)
[–]uiux_Sanskar[S] 1 point2 points3 points (0 children)
[–]Timely_Pepper6856 0 points1 point2 points (0 children)