I can't seem to find an answer to this so I'm stumped. I'm parsing a HTML table using Beautifulsoup and table that starts with a row label `<th>` then followed by the data `<td>`. I'm parsing the data then writing it to a CSV file, I'm having trouble including the "row header" for each row which starts with the `<th>` tag.

This is what I got so far, and it get most of the job done except for the `<th>` row label `<th>`:

```
headers = [header.text.strip() for header in table.find_all('th',{'scope' :'col'})]

rows = []

for row in table.find_all('tr'):
    rows.append([val.text.encode('utf8').rstrip() for val in row.find_all('td')])
with open('filename.csv', 'wb') as f:
    writer = csv.writer(f)
    writer.writerow(headers)
    writer.writerows(row for row in rows if row)

```

Is there a way to append that to the `rows` as well? Any help is much appreciated.