String Rpartition in Python
Level 258 keystrokes
This splits a string from the right using rpartition().
Python code
# Create a string with three "-" separators1text = "a-b-c-d"# rpartition("-") splits at the last "-" instead of the first# It returns a 3-tuple: (before, separator, after)2parts = text.rpartition("-")# Prints ('a-b-c', '-', 'd')3print(parts)Output
('a-b-c', '-', 'd')Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this Python code and how often they appear.
-× 4"× 4(× 2)× 2=× 2.× 1