Python Forum
Python script that deletes symbols in plain text
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python script that deletes symbols in plain text
#1
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!
Reply
#2
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.
Reply
#3
(Sep-05-2023, 03:52 PM)deanhystad Wrote: What operating system are you using

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


Possibly Related Threads…
Thread Author Replies Views Last Post
  Script that alternates between 2 text messages DiscoMatic 1 535 Dec-12-2023, 03:02 PM
Last Post: buran
  Is there a *.bat DOS batch script to *.py Python Script converter? pstein 3 3,279 Jun-29-2023, 11:57 AM
Last Post: gologica
  Parsing xml file deletes whitespaces. How to avoid it? Paqqno 0 1,043 Apr-01-2022, 10:20 PM
Last Post: Paqqno
  cyrillic symbols in tables in reportlab. hiroz 5 11,487 Sep-10-2020, 04:57 AM
Last Post: bradmalcom
  Web Form to Python Script to Text File to zip file to web wfsteadman 1 2,149 Aug-09-2020, 02:12 PM
Last Post: snippsat
  How to kill a bash script running as root from a python script? jc_lafleur 4 5,939 Jun-26-2020, 10:50 PM
Last Post: jc_lafleur
  Unexpected output: symbols for derivative not being displayed saucerdesigner 0 2,061 Jun-22-2020, 10:06 PM
Last Post: saucerdesigner
  crontab on RHEL7 not calling python script wrapped in shell script benthomson 1 2,314 May-28-2020, 05:27 PM
Last Post: micseydel
  Replacing symbols by " Tiihu 1 1,885 Feb-13-2020, 09:27 PM
Last Post: Larz60+
  Simple text to binary python script gmills13 2 2,825 Feb-04-2020, 08:44 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020