python remove characters from end of string

Do you want to know the details regarding “python remove characters from end of string”. If yes, you’re in the correct post.

python remove characters from end of string

foo = "test716"
foo = foo[:-3]
print(foo)
# output will be "test"
txt="abbacabbd"
print(url.replace('bbd',''))

#output:
abbaca
url="abcdc.com"
print(url.replace('.com',''))

Conclusion

I hope this tutorial helps you to know about “python remove characters from end of string”. If you have any queries regarding this article please let us know via the comment section. Share this tutorial with your friends and family via social networks.

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coder Diksha. Here, I post about programming to help developers.

Share on:

Leave a Comment