String Rsplit in Python
Level 257 keystrokes
This splits a string from the right, limiting to 1 split.
Python code
# Create a string with three "-" separators1text = "a-b-c-d"# rsplit("-", 1) splits from the right, at most once (maxsplit=1)# Only the last "-" is used, so everything before it stays together2parts = text.rsplit("-", 1)# 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.× 1