← Lesson
Strings (Text)
Joeven
Run
Reset
Python loads on first run
tool = "search" city = "nyc" print("Calling " + tool + " for " + city) text = "Action" print("first:", text[0]) print("slice:", text[:3]) print("len:", len(text)) print(chr(10).join(["hello", "world"])) line = " search,read,write " clean = line.strip() print("strip:", clean) print("split:", clean.split(",")) print("join:", " | ".join(["think", "act", "observe"])) print("replace:", "Hello".replace("H", "h")) print("https?", "https://example.com".startswith("https://")) print("json file?", "state.json".endswith(".json")) print("find error:", "terror".find("error"), "find missing:", "ok".find("error")) print("lines:", chr(10).join(["think", "act", "observe"]).splitlines()) print("error in terror:", "error" in "terror")
Run to execute this in your browser. Nothing is sent to a server.