Text Strip() now working constantly.

Chris Angelico rosuav at gmail.com
Sat Jan 27 14:10:06 EST 2018


On Sun, Jan 28, 2018 at 5:46 AM,  <nasirahamed40719 at gmail.com> wrote:
> Hi, I'm a begginer in Python, i have a question...
>
> can we use replace method to do it.
>
> E.g. a='cm_text.data'
>      a.replace('.data', ''), this will return output as 'cm_text'.

Yep! That works too. Be aware, though, that it might replace ".data"
in the middle of the string, too. If you know for sure that that won't
happen, then go for it!

BTW, when you reply to someone else's message, it's best to include a
bit of the original text and then type your reply below it - like I do
in this message. That way, people get enough context to understand
what's going on.

ChrisA



More information about the Python-list mailing list