🎯 Tech Learning Journey - Day 04: Python File Handling - Keep Your Data Safe! File handling lets your Python programs talk to files on your computer - reading data from existing files or saving new data into files. It's like having a conversation between your code and your documents. # Writing to a file with open\('notes.txt', 'w'\) as file: file.write\("Hello, from Python!"\) # Reading from a file with open\('notes.txt', 'r'\) as file: content = file.read\(\) print\(content\) Where I use this: Saving user preferences, logging application data, and processing datasets from text or CSV files. #Python #Coding #Programming #FileHandling
Python File Handling Basics: Reading and Writing Files
More Relevant Posts
-
Same Data, Different Memory — Python Data Types Comparison We often choose Python data structures based on ease of use… But rarely think about memory. That can quietly impact performance — especially with large datasets. So I tested how different Python data types behave when storing the same data. Here’s what stood out: • sys.getsizeof() helps measure object memory. • Tuples use less memory than Lists. • Sets consume more memory due to hashing. • String size varies based on content. One important note: - sys.getsizeof() shows memory used by the object itself (in bytes), not the full picture. - Small choices in data structures can lead to big differences in performance. - Something I’ve started paying more attention to while writing code. Do you consider memory usage when choosing data structures, or focus mostly on readability? #Python #Programming #Developers #Coding #SoftwareEngineering #PythonTips #BackendDevelopment #LearningToCode
To view or add a comment, sign in
-
-
📚 Day 30/130 — Python Variables Today in my Python Programming Series, let’s understand one of the most important basics 👇 🔹 What is a Variable? A variable is a container used to store data values in a program. 🔹 Simple Understanding: 👉 Variable = Name that stores a value 🔹 Example: x = 10 name = "Gowthami" 👉 Here, "x" stores a number and "name" stores text 🔹 Rules for Variables: • Must start with a letter or underscore (_) • Cannot start with a number ❌ • No spaces allowed • Case-sensitive (name ≠ Name) 🔹 Types of Values Stored: • Integer → 10 🔢 • String → "Hello" 📝 • Float → 3.14 📊 • Boolean → True/False ✅ 🔹 Why Variables are Important? • Store data for reuse • Make programs dynamic • Improve readability 🔹 Key Idea: 👉 Variables help us store and use data easily in programs 📊See the diagram below for better understanding 📌 Tomorrow’s Topic: 👉 Python Data Types #Python #Programming #Coding #TechLearning #LearningInPublic #Students #Developer #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Exploring Python Data Structures: The Building Blocks of Efficient Code In Python, choosing the right data structure is key to writing clean, efficient, and optimized programs. Here’s a quick overview of the four fundamental data structures every developer should master: 🔹 List Ordered, mutable, and allows duplicate elements. Ideal for storing collections that may change over time. 🔹 Tuple Ordered but immutable. Useful when data integrity is important and values should not be modified. 🔹 Set Unordered collection with no duplicate elements. Perfect for operations like union, intersection, and removing duplicates. 🔹 Dictionary (Dict) Stores data in key-value pairs. Highly efficient for fast lookups and structured data representation. 💡 Understanding when and where to use each of these structures can significantly improve both performance and readability of your code. 📌 Keep learning, keep building! Python offers endless possibilities when you master its core concepts. #Python #Programming #DataStructures #Coding #SoftwareDevelopment #LearningJourney
To view or add a comment, sign in
-
-
🚀 Automated My Downloads Folder Using Python Today, I built a simple yet useful File Organizer script using Python that automatically sorts files into folders. We often download many files, and our Downloads folder becomes messy. So I created a script to organize it automatically 👇 ✨ What This Script Does • Scans all files in the Downloads folder • Moves .jpg files into an Images folder • Moves .pdf files into a PDFs folder • Helps keep files clean and organized ⚙️ Technologies Used • Python • os module (for file handling) • shutil module (for moving files) 🧠 What I Learned • Working with file systems in Python • Automating real-world tasks • Writing efficient and reusable scripts • Importance of automation in daily life 💡 Key Insight Even small automation scripts can save time and improve productivity. If you have suggestions to improve this script (like handling more file types), I’d love to hear them! 😊 #Python #Automation #Programming #LearningInPublic #DeveloperJourney #Productivity #10000Coders #BuildInPublic
To view or add a comment, sign in
-
🚀 Project Completed: Expense Tracker using Python I developed a command-line application to track daily expenses using Python and CSV file handling. 🔹 Features: ✔ Add and store expenses ✔ View all transactions ✔ Calculate total spending 🔗 GitHub Repository: https://lnkd.in/gQ4nwR95. This project helped me understand file handling and build a real-world application. #Python #DataScience #BeginnerProject #Learning
To view or add a comment, sign in
-
🚀 Python Practice – Standard Library Modules Continuing my Python learning journey by exploring the powerful Standard Library 🐍 In this session, I worked with some commonly used modules: ✔️ array – handling collections of elements ✔️ math – mathematical operations ✔️ random – generating random values ✔️ os – file & directory operations ✔️ json – data conversion (dict ↔ JSON) ✔️ csv – reading and writing CSV files ✔️ datetime & time – working with date and time ✔️ re (Regular Expressions) – pattern matching in text Practiced using these modules to perform real-world tasks like file handling, data conversion, and basic data processing. Understanding the Standard Library is helping me write more efficient code without relying on external libraries 📊 A big thanks to Krish Naik for his amazing guidance and clear explanations 🙌 Documented all my practice in a Jupyter Notebook and shared it as a PDF to track my progress. Learning how to use built-in tools to solve real problems step by step 💡 #Python #StandardLibrary #DataAnalytics #LearningJourney #Coding
To view or add a comment, sign in
-
Day 2 – Python Basics+ | Functions, Data Structures, and File I/O** Continuing the beginner Python series with 15 new scripts that build on fundamentals and introduce practical, everyday concepts. **Focus areas for Day 2:** Functions, lists, dictionaries, string methods, control flow, and basic file handling. Each file isolates one concept to support focused learning and easy reference. **Day 2 program list:** | Concept | File | | --- | --- | | Function definition & calls | `01_functions_basic.py` | | Built-in list operations | `02_list_operations.py` | | List comprehensions | `03_list_comprehension.py` | | String methods | `04_string_methods.py` | | Dictionary lookups | `05_dictionary_basics.py` | | Dictionaries as counters | `06_count_characters.py` | | `while` loops + `random` | `07_guessing_game.py` | | Return values | `https://lnkd.in/gFhEe698` | | Sets for deduplication | `09_remove_duplicates.py` | | Math with loops | `10_sum_of_digits.py` | | String slicing | `11_slice_examples.py` | | Sorting & edge cases | `12_find_second_largest.py` | | File read/write | `13_file_write_read.py` | | Anagram checking | `14_check_anagram.py` | | Modules `random` & `string` | `15_simple_password_gen.py` | **How to use:** All scripts use only the Python standard library. Clone the repo, ensure Python 3 is installed, and run any file directly: `python 05_dictionary_basics.py` To run everything at once, reuse the Day 1 runner and update the `PROGRAMS` list with the Day 2 filenames. This set is designed for students, self-learners, and instructors who need clear, modular examples for practice or teaching. Repository link in the first comment. Building this as a multi-day series. If you found Day 1 helpful, Day 2 adds the data structures and file handling that most beginners need next. What topic should Day 3 cover — error handling, OOP basics, or working with APIs? #Python #SoftwareEngineering #LearnToCode #Programming #ComputerScience #DataStructures #SoftwareDevelopment #TechEducation #OpenSource #GitHub #Coding #PythonProgramming Thread Link :- https://lnkd.in/gzzpXUid
To view or add a comment, sign in
-
Day 26 of #100DaysOfCode👩💻🚀 Today I learned about Getter, Setter, and 3 types of methods in Python OOP. Getter & Setter methods: Getters are used to access private data safely → `get_name()` Setters are used to update private data with validation → `set_age()` They help protect data and add control over how variables are read or changed. 3 Types of Methods in Python: 1. Instance method → Uses `self`, works with object data. Called by objects. 2. Class method → Uses `@classmethod` and `cls`, works with class variables. Called by class. 3. Static method → Uses `@staticmethod`, doesn’t use `self` or `cls`. Like a normal function inside class. One more step toward writing clean, secure OOP code. Special thanks to the CEO G.R NARENDRA REDDY Sir for constant guidance and motivation. #Python #OOP #GetterSetter #100DaysOfCode #LearningJourney #Programming
To view or add a comment, sign in
-
-
*Day 27 of my python learning journey 3 simple Python concepts I learned today: 1. Garbage Collector: Python automatically removes unused data from memory. So we don’t need to clean it manually. It keeps code fast and memory safe. 2. 4 Pillars of OOP : - >Encapsulation→ Keep data safe inside class - >Abstraction → Hide extra details, show only important stuff - >Inheritance → Child class can use parent class features - >Polymorphism → Same name, different work. Like `+` for add & join 3. pass Statement: Used when we don’t want to write code yet but need to keep empty space. Ex: `if True: pass` → Python won’t give error. Learning to write cleaner and smarter code step by step. Special thanks to the CEO G.R NARENDRA REDDY Sir for constant guidance and motivation. #Python #OOP #100DaysOfCode #LearningJourney
To view or add a comment, sign in
-
-
🚀 Learning Python OOP – Encapsulation in Action! Today I practiced a simple Bank Account example to understand the concept of Encapsulation in Python. In this example, I created a Bank class where sensitive data like PIN and balance are kept private using double underscores (__pin, __balance). This ensures that the data cannot be accessed directly from outside the class and can only be used through defined methods like checking balance or updating the PIN. This concept helps in: ✔ Protecting sensitive data ✔ Improving code security ✔ Controlling how data is accessed and modified This example was taught in our class, and implementing it on my own really helped me understand how encapsulation works in real scenarios. Excited to keep building more concepts as part of my Data Science learning journey 📊🐍 #Python #PythonLearning #ObjectOrientedProgramming #Encapsulation #DataScienceJourney #Coding #LearningByDoing #BeginnerProgrammer
To view or add a comment, sign in
-
Explore related topics
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development