Important Notice:

File Processing (Index)

File Processing (Index)

42 views 2 min read

File Processing 

 

7.1 Introduction to File Processing

  • 7.1.1 Concept of Files
  • 7.1.2 Need for Files
  • 7.1.3 Types of Files
  • 7.1.4 Text Files
  • 7.1.5 Binary Files
  • 7.1.6 File Processing in Python

7.2 Opening and Closing a File

  • 7.2.1 Opening a File
  • 7.2.2 open() Function
  • 7.2.3 File Object
  • 7.2.4 Closing a File
  • 7.2.5 close() Function
  • 7.2.6 Using with Statement

7.3 File Opening Modes

  • 7.3.1 Read Mode — r
  • 7.3.2 Write Mode — w
  • 7.3.3 Append Mode — a
  • 7.3.4 Create Mode — x
  • 7.3.5 Read and Write Mode — r+
  • 7.3.6 Write and Read Mode — w+
  • 7.3.7 Append and Read Mode — a+
  • 7.3.8 Binary Mode — b

7.4 Reading from a File

  • 7.4.1 Reading Complete File
  • 7.4.2 read() Function
  • 7.4.3 Reading a Specific Number of Characters
  • 7.4.4 readline() Function
  • 7.4.5 Reading Multiple Lines
  • 7.4.6 readlines() Function
  • 7.4.7 Reading File Using for Loop

7.5 Writing onto a File

  • 7.5.1 Writing Data to a File
  • 7.5.2 write() Function
  • 7.5.3 Writing Multiple Lines
  • 7.5.4 writelines() Function
  • 7.5.5 Writing Using with Statement
  • 7.5.6 Difference Between write() and writelines()

7.6 File Position

  • 7.6.1 File Pointer
  • 7.6.2 tell() Function
  • 7.6.3 seek() Function
  • 7.6.4 Moving File Pointer
  • 7.6.5 Difference Between tell() and seek()

7.7 File Functions

  • 7.7.1 open()
  • 7.7.2 close()
  • 7.7.3 read()
  • 7.7.4 readline()
  • 7.7.5 readlines()
  • 7.7.6 write()
  • 7.7.7 writelines()
  • 7.7.8 tell()
  • 7.7.9 seek()

7.8 Command Line Arguments

  • 7.8.1 Introduction to Command Line Arguments
  • 7.8.2 sys.argv
  • 7.8.3 Accessing Command Line Arguments
  • 7.8.4 Number of Command Line Arguments
  • 7.8.5 Command Line Arguments with Files
  • 7.8.6 Simple Programs Using Command Line Arguments

7.9 File Processing Examples

  • 7.9.1 Create and Write a File
  • 7.9.2 Read Data from a File
  • 7.9.3 Read File Line by Line
  • 7.9.4 Append Data to a File
  • 7.9.5 Count Characters in a File
  • 7.9.6 Count Words in a File
  • 7.9.7 Count Lines in a File
  • 7.9.8 Search Text in a File
  • 7.9.9 Copy Content from One File to Another

7.10 Practice Programs

  • Program 1: Create and Write Data into a File
  • Program 2: Read Data from a File
  • Program 3: Read a File Line by Line
  • Program 4: Read Multiple Lines Using readlines()
  • Program 5: Append Data to a File
  • Program 6: Write Multiple Lines Using writelines()
  • Program 7: Demonstration of tell()
  • Program 8: Demonstration of seek()
  • Program 9: Count Number of Lines in a File
  • Program 10: Count Number of Words in a File
  • Program 11: Count Number of Characters in a File
  • Program 12: Search a Word in a File
  • Program 13: Copy One File into Another File
  • Program 14: Read File Using Command Line Arguments
  • Program 15: Display File Content Using Command Line Arguments



Related Notes