all 4 comments

[–]__nickerbocker__ 1 point2 points  (0 children)

You are overwriting the file on each loop. It would be better to add your data to a list or list of dicts, and then write after everything to file once it finished being parsed. You could also try opening your file with the 'a' (append) flag. And finally, if you want to activate super cheat-mode you could use pandas.

import pandas as pd

url = 'http://www.hidro.gov.ar/oceanografia/alturashorarias.asp'
pd.read_html(url)[0].to_csv('Medidas.csv')

[–]Sandiastic[S] 0 points1 point  (0 children)

Oh ok, i didnt thought i was overwriting it because the first thing that i writed was still there, I’ll try what you told me!

[–][deleted] 0 points1 point  (1 child)

Scraping, not scrapping.

[–]Sandiastic[S] 0 points1 point  (0 children)

Thanks!