471,624 Members | 2,097 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,624 software developers and data experts.

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.
2 Weeks Ago #1
1 7912
dev7060
611 Expert 512MB
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.
2 Weeks Ago #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by johkar | last post: by
2 posts views Thread by charlie_M | last post: by
2 posts views Thread by UJ | last post: by
6 posts views Thread by larry mckay | last post: by
25 posts views Thread by electrixnow | last post: by
6 posts views Thread by bruce | last post: by
4 posts views Thread by Ahmed, Shakir | last post: by
reply views Thread by Adam Pletcher | last post: by
reply views Thread by leo001 | last post: by
1 post views Thread by ZEDKYRIE | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.