human
Removing white space from txt with python
assistant
Here is some code to substitute two or more whitespace characters with character '|' in string `line`

re.sub('\\s{2,}', '|', line.strip())

#Warning: this code generation is experimental. Please inspect the code for any bugs before executing.