Can anyone help me resolve the issue of extra "\n"s being printed as output?
Parsing HTML Tables
Hey @developerkushal, you need to remove it individually from the columns by iterating over them, there’s no direct way to do it.
Hope this cleared your doubt.
But the question is why did the "\n"s not show up when Prateek Bhaiya did it in the tutorial?
I think you need to change “if idx==0 or idx==3:” instead of “if idx!=0 and idx!=3:”.
Sorry, it’s wrong. Try again.
Share your ipynb notebook after uploading it on google drive and sharing the link here.
Use this code,
table_rows = []
for row in rows_data:
current_row = []
row_data = row.findAll(‘td’, {})
for idx,data in enumerate(row_data):
current_row.append(data.text[:-1])
print(current_row)
table_rows.append(current_ro
It will print desired results.
1 Like
Thank you so much for helping me out!