Re: [newbie] how to remove empty lines from webpage/file

2018-02-27 Thread Dan Stromberg
Perhaps replace: lines=soup.get_text() file.write(lines) ...with something like: text = soup.get_text() lines = text.split('\n') for line in lines: if line.strip(): file.write('%s\n' % (line, )) (untested) On Tue, Feb 27, 2018 at 2:50 AM, wrote: > Dear all, > I try to get the nume

[newbie] how to remove empty lines from webpage/file

2018-02-27 Thread jenswaelkens
Dear all, I try to get the numerical data from the following webpage: http://www.astro.oma.be/GENERAL/INFO/nzon/zon_2018.html With the following code-fragment I was already able to get a partial result: #!/usr/bin/env python #memo: install bs4 as follows: sudo easy_install bs4 # -*- coding: utf-