Write a program to replace all spaces from text with - (dash)from the file podar.txt.

Question

Write a program to replace all spaces from text with - (dash)from the file podar.txt.
🧐 Not the exact question you are looking for?Go ask a question

Solution 1

Sure, here is a simple Python program that reads a file, replaces all spaces with dashes, and writes the result back to the file.

# Open the file in read mode and read its content
with open('podar.txt', 'r') as file:
    content = file.read()

# Replace all spaces with dashes
content = co
    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

Write a program to replace all spaces from text with - (dash)from the file podar.txt.

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

Create a text file "podar.txt" in python and ask the user towrite a single line of text by user input

Write a Python program to replace whitespaces with an underscore and vice versa.

File Handling:●Write a program that reads a text file and prints the number of words in it

1/3