RosettaCodeData/Task/Binary-strings/Python/binary-strings-6.py
Ingy döt Net 86c034bb8b new files
2013-04-10 12:38:42 -07:00

6 lines
237 B
Python

txt = "Some more text"
assert txt[4] == " "
assert txt[0:4] == "Some"
assert txt[:4] == "Some" # you can omit the starting index if 0
assert txt[5:9] == "more"
assert txt[5:] == "more text" # omitting the second index means "to the end"