🔥Limited Offer: Get 50% OFFon AI & Full Stack Courses🔥
Back to Python Notes
Topic #19

Modify Strings


Python has a set of built-in methods that you can use on strings.


Upper Case

Example

a = "Hello, World!"
print(a.upper())

Lower Case

Example

a = "Hello, World!"
print(a.lower())

Remove Whitespace

Whitespace is the space before and/or after the actual text, and very often you want to remove this space.

Example

a = " Hello, World! "
print(a.strip()) # returns "Hello, World!"

Replace String

Example

a = "Hello, World!"
print(a.replace("H", "J"))

Split String

The split() method returns a list where the text between the specified separator becomes the list items.

Example

a = "Hello, World!"
print(a.split(",")) #
  returns ['Hello', ' World!']

Learn more about Lists in our Python Lists chapter.


String Methods

Learn more about String Methods with our String Methods Reference

Want to go beyond the notes?

Join CodingNow 2.0's Python course — live mentorship, real projects, and 100% placement support.

Enroll Now — Free Demo Available

Modify Strings – FAQs

Quick answers about learning Modify Strings in Python.

This free note from CodingNow 2.0 explains Modify Strings in Python — concept, syntax and worked code examples you can copy, run and revise before interviews.
Yes. Every Python topic on CodingNow 2.0, including Modify Strings, is 100% free with no signup required.
With focused practice, most students grasp Modify Strings in 1–3 days from these notes; pairing it with CodingNow 2.0's mentor-led course takes you to job-ready depth faster.
Use the code examples in this note, then ask doubts for free on the CodingNow 2.0 Community (/community) — expert instructors answer within 24 hours.
WhatsApp
Call NowEnroll Now