Python Forum

Full Version: Python script that deletes symbols in plain text
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I need a python script that deletes all symbols in a plain text file.
For example, I want that all 'd', all 'f' and all '0' (zeros) in a plain text file to be deleted and not replaced by other symbols.

Is open() good for this task or I should use something else?

Thanks i advance!
You cannot delete things from a file. You can read a file and write a new file that has the contents of the old sans the unwanted symbols.

There are tools that do this kind of thing. What operating system are you using.
(Sep-05-2023, 03:52 PM)deanhystad Wrote: [ -> ]What operating system are you using

Linux
Link to stackoverflow post where sed is used to remove strings from a file.
https://stackoverflow.com/questions/5998...-text-file