Updated extract.py

newlines variable is a list of strings rather than one long string