0

I have data like:

test="1. My Contact Number (Nortel/Mobile): 7774096182 2. My Preferred Time (in IST) to be contacted: 11am to 8pm Please book a daily bridge line, below are the details: Start Date: 06-July-2016 End Date: 05-Aug-2016 Time: 3 pm to 6 pm ( 3-hr duration) Number of participants: 25 on every friday We require the bridge line daily during this slot. Regards, Smriti Varma."

test1="Hi Team, Please arrange Audio Bridge call thru Nortel & Landline only for tomorrow Dated 16-Jun-2016 between 12.30 PM to 1.30 PM (IST), Number of Paticipants: 06 1. My Contact Number (Nortel/Mobile): 2. My Preferred Time (in IST) to be contacted:"

I don't want the line in both:

text="1. My Contact Number (Nortel/Mobile): 2. My Preferred Time (in IST) to be contacted:","1. My Contact Number (Nortel/Mobile): 7774096182 2. My Preferred Time (in IST) to be contacted: 11am to 8pm"
Ahmed Ashour
  • 5,179
  • 10
  • 35
  • 56

1 Answers1

0

I don't know what the end result you want, but you could use the str.replace().
So something like:

test = "1. My Contact Number (Nortel/Mobile): 7774096182 2. My Preferred Time (in IST) to be contacted: 11am to 8pm Please book a daily bridge line, below are the details: Start Date: 06-July-2016 End Date: 05-Aug-2016 Time: 3 pm to 6 pm ( 3-hr duration) Number of participants: 25 on every friday We require the bridge line daily during this slot. Regards, Smriti Varma."

test1 = "Hi Team, Please arrange Audio Bridge call thru Nortel & Landline only for tomorrow Dated 16-Jun-2016 between 12.30 PM to 1.30 PM (IST), Number of Paticipants: 06 1. My Contact Number (Nortel/Mobile): 2. My Preferred Time (in IST) to be contacted:"

text = ["1. My Contact Number (Nortel/Mobile): 2. My Preferred Time (in IST) to be contacted:","1. My Contact Number (Nortel/Mobile): 7774096182 2. My Preferred Time (in IST) to be contacted: 11am to 8pm"]

test_modified = test.replace(text[0], "")
test1_modified = test1.replace(text[1], "")

How to use string.replace() in python 3.x

But it depends on the complexity of your "test" strings if you would like to generally look for them.

Community
  • 1
  • 1
fedepad
  • 4,509
  • 1
  • 13
  • 27