Back

Sanskar

Keen Learner and Exp...ย โ€ขย 4d

Day 10 of learning python as a beginner. 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). 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.

2 Replies
3
Replies (2)

More like this

Recommendations from Medial

Image Description
Image Description

Yash

YoYoย โ€ขย 8m

I know the basics of python language like functions, file handling, stack, etc what should I learn in python to get the fastest internship or job as freshers

4 Replies
2

Yash Pratap

csoc.inย โ€ขย 11m

[This post has been deleted by the creator]

1 Reply
5

Muttu Havalagi

๐ŸŽฅ-๐ŸŽต-๐Ÿ-โšฝ "Finding ...ย โ€ขย 1y

1. Python: - History: Python was created by Guido van Rossum and was first released in 1991. Its design philosophy emphasizes code readability and its syntax allows programmers to express concepts in fewer lines of code. - Unique Fact: The name

See More
Reply
1
Image Description

vishakha Jangir

ย โ€ขย 

Set2Scoreย โ€ขย 1m

My first chatbot !! I am creating a chatbot for my startup using various tools like Python, its libraries, and OpenAI API keys. Iโ€™ll share it once itโ€™s done! I also took a course on Udemy to gain more insights into the process. If youโ€™ve ever cre

See More
1 Reply
7

Sanskar

Keen Learner and Exp...ย โ€ขย 3d

Day 11 of learning python as a beginner. Topic: creating journal entry program using file I/O. I got a little sidleline from my original plan of editing my to-do list program and created an entirely new program this time for writing a daily journal

See More
Reply
1
10

Suraj Dusane

Hey I am on Medialย โ€ขย 1y

How I Complete My 5-Day Boring Task in Less Than Half an Hour๐Ÿ‘‡๐Ÿป 1. Eureka Moment: So, I was stuck making PowerPoint slides manually, which was a real pain. Then, I had this genius idea to make things easier by automating the whole process. 2. Hun

See More
Reply
9
Image Description
Image Description

Vagle

Hakuna matataย โ€ขย 2m

Google I/O 2025 in a nutshell.

2 Replies
1
22
Image Description
Image Description

Lucky

Hey I am on Medialย โ€ขย 10m

what about a platform that contain medical history of customers and only doctor can access and without the hectic of carrying file and reports???

3 Replies
1
Image Description

Rajat Garg

Hey I am on Medialย โ€ขย 1y

Can somebody explain the I/O in the simplest terms?

5 Replies
2

Download the medial app to read full posts, comements and news.