Collapse paragraphs

#!/usr/bin/env python
# ignores witespace
# collapses paragraphs
import sys
for line in sys.stdin:
    line = line.strip()
    if len(line) == 0:
        sys.stdout.write('\n\n')
    else:
        sys.stdout.write(line+' ')