Python Forum
Need your small favor
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need your small favor
#3
(Mar-21-2017, 04:00 AM)desul Wrote: Hiii,

How can I remove "[inside some number], (Fig. 8))from the line?

I have tried by using below command but it is not working. please tell me another method for it ........

e.g. [18], (Fig. 8)

line= line.replace("[/0-9]", "")

Your code is removing the string "[/0-9]".  Per your example, that should never be in the source string.
It looks like you're trying to write a regular expression, which is what zivoni demonstrated.  For testing, I like regexpal (http://www.regexpal.com/), since regular expressions can quickly get complicated.
Reply


Messages In This Thread
Need your small favor - by desul - Mar-21-2017, 04:00 AM
RE: Need your small favor - by zivoni - Mar-21-2017, 08:52 AM
RE: Need your small favor - by nilamo - Mar-22-2017, 08:03 PM

Forum Jump:

User Panel Messages

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