#1 India's Top IT Training Institute

×

About Uncodemy

Know more about who we are and what we stand for.

About Us

About Us

Discover our mission to equip individuals with essential IT skills and industry expertise.

Read More →
UnCodeMy Gallery

UnCodeMy Gallery

Explore highlights from our IT training sessions and success stories.

Read More →
×

Free Resources

Learn, practice and plan your career — bilkul free.

Tutorials

Tutorials

Step-by-step written tutorials to learn any technology at your own pace.

Read More →
Free Counselling

Free Counselling

Book a free video counselling session and pick the right course for you.

Read More →
Online Compiler

Online Compiler

Write, run and test your code online — no setup required.

Read More →
⚡ FREE · REAL PYTHON

Python String Methods Playground: Try Every str Method on Your Own Text

Pick a string method, set the arguments and see what real Python returns.

  • 🔤 39 str methods
  • 🧾 Result and its type
  • 🔒 Runs in your browser

How to use the Python String Methods Playground

  1. 1. Type a stringSpaces at the ends are kept, so you can test strip().
  2. 2. Pick a methodTypical arguments fill in; change them to experiment.
  3. 3. RunSee the exact repr() of the result, its type and its length.

Methods covered

  • Case: upper, lower, title, capitalize, swapcase, casefold.
  • Trimming: strip, lstrip, rstrip, removeprefix, removesuffix.
  • Splitting: split, rsplit, splitlines, partition, rpartition.
  • Searching: find, rfind, index, count, startswith, endswith, replace.
  • Checks: isalpha, isdigit, isnumeric, isalnum, isspace, isupper, islower, istitle.
  • Padding and others: center, ljust, rjust, zfill, encode, expandtabs, format, join.

Results are shown with repr(), the way Python's console shows them, so you can see quotes, \n line breaks and leading spaces that print() would hide. Because Python strings are immutable, the original string is listed too, always unchanged.

Worked example

The sample string is ' Learn Python with Uncodemy! ', 31 characters with two spaces at each end. .strip() returns 'Learn Python with Uncodemy!', type str, length 27. Then try:

  • .split() returns ['Learn', 'Python', 'with', 'Uncodemy!'], a list of 4. Extra spaces are ignored when no separator is given.
  • .find('Python') returns 8, and .find('Java') returns -1, while .index('Java') raises a ValueError.
  • .replace('Python', 'Py') changes every match; add a third argument to limit how many.
  • For .join, the string is the separator: with s set to ', ' and the argument ['a', 'b', 'c'], you get 'a, b, c'.

The code runs in real Python 3 (Pyodide), loaded once in your browser, so the results are exactly what Python gives.

Frequently asked questions

What is the difference between isdigit and isnumeric?

isnumeric also accepts characters like ½ and Devanagari digits such as ३. isdecimal is the strictest of the three.

Why doesn't strip() change my string?

Strings can't be changed in place. Assign the result: s = s.strip().

Can I chain methods?

In your own code, yes: s.strip().lower().split(). Here, run one method at a time to see each step.

Do I have to pay for the python string methods playground?

No, it is free. Your first run asks for your name and WhatsApp number one time only. Then the python string methods playground and all other Uncodemy tools stay open for you with no form.

More free tools

See all free tools