• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
PythonForBeginners.com

PythonForBeginners.com

Learn By Example

  • Home
  • Learn Python
    • Python Tutorial
  • Categories
    • Basics
    • Lists
    • Dictionary
    • Code Snippets
    • Comments
    • Modules
    • API
    • Beautiful Soup
    • Cheatsheet
    • Games
    • Loops
  • Python Courses
    • Python 3 For Beginners

Files

How to Search for a String in a Text File Through Python

Author: Josh Petty
Last Updated: October 31, 2022

In this post, we’ll explore the various methods used to search for a string in a text file. Using examples written in Python 3, we’ll demonstrate how … [Read more...] about How to Search for a String in a Text File Through Python

Filed Under: Files, Strings Author: Josh Petty

How to Extract a Date from a .txt File in Python

Author: Josh Petty
Last Updated: August 31, 2021

In this tutorial, we’ll examine the different ways you can extract a date from a .txt file using Python programming. Python is a versatile language—as … [Read more...] about How to Extract a Date from a .txt File in Python

Filed Under: Files Author: Josh Petty

How to Open a Non-Text File in Python

Author: Josh Petty
Last Updated: August 2, 2021

The Python standard library provides several tools for reading and writing text files, but what about non-text files? With Python, it’s possible to … [Read more...] about How to Open a Non-Text File in Python

Filed Under: Files Author: Josh Petty

The Fastest Way to Split a Text File Using Python

Author: Josh Petty
Last Updated: June 5, 2023

Python is one of the most popular programming languages in the world. One reason for its popularity is that Python makes it easy to work with data. … [Read more...] about The Fastest Way to Split a Text File Using Python

Filed Under: Files, Split Author: Josh Petty

How to Delete a Specific Line in a File

Author: Josh Petty
Last Updated: June 10, 2021

Because Python provides no direct method for deleting a specific line in a file, it’s necessary to find our own approach. In this guide, we’ll … [Read more...] about How to Delete a Specific Line in a File

Filed Under: Filehandling, Files Author: Josh Petty

4 Ways to Read a Text File Line by Line in Python

Author: Josh Petty
Last Updated: May 27, 2021

Reading files is a necessary task in any programming language. Whether it’s a database file,  image, or chat log, having the ability to read and … [Read more...] about 4 Ways to Read a Text File Line by Line in Python

Filed Under: Filehandling, Files Author: Josh Petty

With Open Statement in Python

Author: PFB Staff Writer
Last Updated: June 9, 2023

In Python, you can access a file by using the open() method. However, using the open() method requires you to use the close() method to close the file … [Read more...] about With Open Statement in Python

Filed Under: Files, System & OS Author: PFB Staff Writer

Reading and Writing Files in Python

Author: PFB Staff Writer
Last Updated: December 3, 2021

Overview When you’re working with Python, you don’t need to import a library in order to read and write to a file. It’s handled natively in the … [Read more...] about Reading and Writing Files in Python

Filed Under: Filehandling, Files, io, System & OS Author: PFB Staff Writer

File Handling Cheat Sheet in Python

Author: PFB Staff Writer
Last Updated: January 31, 2021

File Handling File handling in Python requires no importing of modules. File Object Instead we can use the built-in object "file". … [Read more...] about File Handling Cheat Sheet in Python

Filed Under: Cheatsheet, Files Author: PFB Staff Writer

Primary Sidebar

Menu

  • Basics
  • Cheatsheet
  • Code Snippets
  • Development
  • Dictionary
  • Error Handling
  • Lists
  • Loops
  • Modules
  • Scripts
  • Strings
  • System & OS
  • Web

Get Our Free Guide To Learning Python

Most Popular Content

  • Reading and Writing Files in Python
  • Python Dictionary – How To Create Dictionaries In Python
  • How to use Split in Python
  • Python String Concatenation and Formatting
  • List Comprehension in Python
  • How to Use sys.argv in Python?
  • How to use comments in Python
  • Try and Except in Python

Recent Posts

  • Count Rows With Null Values in PySpark
  • PySpark OrderBy One or Multiple Columns
  • Select Rows with Null values in PySpark
  • PySpark Count Distinct Values in One or Multiple Columns
  • PySpark Filter Rows in a DataFrame by Condition

Copyright © 2012–2025 · PythonForBeginners.com

  • Home
  • Contact Us
  • Privacy Policy
  • Write For Us