Python Forum
Removing the unwanted data from a file
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Removing the unwanted data from a file
#1
I've done a grep search through all these emails and folders. The output is in a file. The data is like this

Quote:family/Smallville, Robert & Mary/28134: Bioelectro healing - https://t.me/bioelectromagnetic_healing

All I want is the URI, so that I'm left with

Quote:https://t.me/bioelectromagnetic_healing

I assume in Python, I simply search for the string "https", then remove the data from zero position up to the position where the search has found that string. Looks simple in the example data above. yet many lines in the file have data after the end of the complete URI. I guess a search again to find a blank/space ?

From https://www.w3schools.com/python/ref_string_find.asp an example ..

txt = "Hello, welcome to my world."

x = txt.find("e")

print(x)
Should I use 'find' or 'search' for this ? No doubt it is just an "open" of the file, then a "for" loop to check for the string.
Reply


Messages In This Thread
Removing the unwanted data from a file - by jehoshua - Nov-14-2021, 12:39 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  How to remove unwanted images and tables from a Word file using Python? rownong 2 949 Feb-04-2025, 08:30 AM
Last Post: Pedroski55
Question Unwanted execution of unittest ThomasFab 9 4,649 Nov-15-2022, 05:33 PM
Last Post: snippsat
  HELP on Unwanted CSV Export Output | Using Selenium to Scrape soothsayerpg 0 1,875 Jun-13-2021, 12:23 PM
Last Post: soothsayerpg
  xml file creation from an XML file template and data from an excel file naji_python 1 2,967 Dec-21-2020, 03:24 PM
Last Post: Gribouillis
  How to save CSV file data into the Azure Data Lake Storage Gen2 table? Mangesh121 0 2,724 Jun-26-2020, 11:59 AM
Last Post: Mangesh121
  How to eliminate unwanted spaces Mohan 5 4,497 Jun-04-2020, 08:34 AM
Last Post: buran
  Removing Certain Numbers From File chascp 2 3,042 Feb-07-2020, 04:04 PM
Last Post: chascp
  Unwanted delay between looped synth plays WolfeCreek 1 2,993 Aug-02-2018, 09:24 PM
Last Post: Vysero
  Unwanted variable change in module dannyH 2 3,600 May-08-2018, 05:33 PM
Last Post: dannyH
  Unwanted random generation of scripted Shapes in GASP diemildefreude 3 6,574 Oct-23-2016, 03:11 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