Menu

Post image 1
Post image 2
Post image 3
1 / 3
0

Python Week 6: Our Programs Finally Read Real Files

DEV Community·Navas Herbert·3 months ago
#cFtNCqC9
Reading 0:00
15s threshold

Every program we'd built so far had one problem. The moment you closed it, everything disappeared. The students we added to the registry. The scores we calculated. The transactions we analysed. Gone. You'd open the program again, and it would start from scratch. Real software doesn't work like that. Real software reads from files, processes data, writes results back out. Real software persists. Week 6 was the week we crossed that line. I walked in with a file called students.csv - 30 rows of messy, real-looking student data. Names in wrong cases. Missing scores. Inconsistent course names. I put it on the projector and said: "By the end of today, Python will read this, clean it, and report on it. Without us touching a single row manually." The room got quiet in the good way. String Methods: Cleaning Up Messy Text Before we touched any file, we needed sharper tools for working with text. Real data is almost always dirty - inconsistent capitalisation, rogue spaces, mixed formats.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.

Read More