String Splitlines in Python
Level 253 keystrokes
This splits a string at line boundaries using the splitlines() method, returning a list of lines.
Python code
# Create a multi-line string using \n for newlines1text = "line1\nline2\nline3"# splitlines() splits at each newline character# Returns a list of individual lines2print(text.splitlines())Output
['line1', 'line2', 'line3']
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.
"× 2(× 2)× 2\× 2.× 1=× 1