Skip to content

mkyong.com

  • Spring Boot
  • Java Virtual Threads
  • Contact
  1. Home /
  2. trim

Tag: trim

python August 15, 2019 1 min read by mkyong 0 comments

Python – How to trim a String?

In Python trim method is called strip, it removes the leading and trailing spaces of a String. str.strip() #trim str.lstrip() #ltrim str.rstrip() #rtrim #!/usr/bin/python str = " abc " print(str) print(str.strip()) print(str.lstrip()) print(str.rstrip()) Output {space} abc {space} abc abc {space} {space} abc References Python docs str.strip()

Read more Python – How to trim a String?

Mkyong.com has provided Java and Spring tutorials, guides, and code snippets since 2008. All published articles are simple, easy to understand, and well-tested in our development environment.

Mkyong.com licenses all source code on this website under the MIT License.

About
  • About Us
  • Code License
  • Privacy Policy
  • Terms Of Use
  • Contact Us
Tools
  • Spring Framework
  • Quarkus Framework
  • Micronaut Framework
  • Oracle Java JDK
  • Eclipse Temurin JDK
  • OpenJDK JDK
  • Hibernate ORM
  • Maven Build Tool
  • Gradle Build Tool
  • Tomcat Application Server
  • Docker
Links
  • Maven Central
  • Docker Hub
  • Spring Guides
  • Quarkus Guides
  • Micronaut Guides
  • Martin Fowler
  • AskPython

© 2026 mkyong.com — Powered by WordPress

About How these posts are written
RSS