Not sure if you mean the ```re.match()``` or ```n_ws = ...```.  The former works because I also want to remove initial lines containing just a newline character; the latter because ```n_ws = 0 or 0``` results in ```n_ws = 0``` (and further down the ```re.sub()``` works for ```n_ws = 0``` because  although the replacement happens even when there are no leading spaces to replace, what gets substituted is a zero length string.