#Write a program to create a text file and print the lines starting with ‘T’ or ‘P’. (Both# uppercase and lowercase)

Question

#Write a program to create a text file and print the lines starting with ‘T’ or ‘P’. (Both# uppercase and lowercase)
🧐 Not the exact question you are looking for?Go ask a question

Solution 1

Sure, here is a Python program that creates a text file and prints the lines starting with 'T' or 'P' (both uppercase and lowercase).

# Step 1: Create a text file and write some data into it
with open('test_file.txt', 'w') as f:
    f.write('This is a test file.\n')
    f.write('Python is
    Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solve study prob
Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solve study problem.
Knowee AI StudyGPT is a powerful AI-powered study tool designed to help you to solv

This problem has been solved

Similar Questions

0/0