Skip to content
Justice Tech School

More String Methods

split, join, strip, replace, find, startswith, endswith, upper, lower, title and count cover most text work.

Example
s = "  Hello, World  "
print(s.strip().lower(), s.count("l"), s.find("World"))
print("-".join(["a", "b", "c"]), "a,b".split(","))

Result

hello, world 3 9
a-b-c ['a', 'b']

Exercise

Join with a dash.

"-".(["a","b"])

Quiz Test

Which removes surrounding spaces?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.