Removing a pattern from a text string.

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • aaander
    New Member
    • Nov 2022
    • 1

    Removing a pattern from a text string.

    I'm fairly new to python and was looking for a way to remove all instances of a pattern, a % and the two characters following it, from a text string. I've read the docs on a few functions like str.replace, and filter() hoping for a way to do it. So far I've had no success.

    I'm aware it's an ascii character, but as I can't forecast which character I might get in the future, this seems the way to go for what I'm doing.

    I'd appreciate any help or advice anyone's willing to give.
  • dev7060
    Recognized Expert Contributor
    • Mar 2017
    • 656

    #2
    I'm fairly new to python and was looking for a way to remove all instances of a pattern, a % and the two characters following it, from a text string. I've read the docs on a few functions like str.replace, and filter() hoping for a way to do it. So far I've had no success.

    I'm aware it's an ascii character, but as I can't forecast which character I might get in the future, this seems the way to go for what I'm doing.

    I'd appreciate any help or advice anyone's willing to give.
    You may want to look into regular expressions.

    Comment

    Working...