DEV Community

Cover image for How To Modify String In Python?
Mrexamples
Mrexamples

Posted on

How To Modify String In Python?

This article will teach Python modify strings with examples, hopefully fulfilling education needs.

In Python, strings can be manipulated using built-in methods.

Python Modify Strings In Upper Case

Strings returned by upper() are always capitalized:

Edit Strings In Lower Case

A lower() method returns a string that is in lower case:

Remove Whitespace

When you modify Python strings, you often want to eliminate whitespace before and/or after the string text.

Using strip(), any whitespace at the start or end of a string is removed:

Learn More

Top comments (0)