Read UTF-8 Note File Statistics
Write text into a UTF-8 file inside a temporary directory, then open and read it with a context manager. Return lines, words and characters counts. Lines follow str.splitlines() (a final newline adds no extra empty line); words follow str.split(); characters count Unicode code points. Preserve newline characters by opening with newline="". Do not leave files behind.
Difficulty: intermediate
Examples
["Learn Python\nPractice daily\n"]{"lines":2,"words":4,"characters":28}