Answer to Question #235901 in Python for aakash

Question #235901

Write a program in Python allowing to delete multiple spaces in a text file

named myfile.txt which contains a text: T =

'Python is programming language'



1
Expert's answer
2021-09-11T07:01:19-0400


f = open("mytext.txt" , "r")
content = f.read()
f.close()
words = content.split() 


f = open("mytext.txt" , "w")


for word in words:
    f.write(word )
f.close()

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS