+ 1
Remove and edit strings from python file
https://code.sololearn.com/cA769D2Qd3Vg/?ref=app How would you remove and edit a string in a python file?
2 odpowiedzi
+ 4
You can remove a file by:
import os
os.remove("filename")
You can modify a file by:
file = open("filename", "w")
#but it clears the file content first
file.write("new content")
file.close()
You can also modify a file by:
file = open("filename", "a")
#It doesn't clear the content
file.write("new content")
#adds some new content in the end of the file.
file.close()
0
im trying to look for a runner and remove all their details or edit their details as you can see from the functions