<table class="table-print">
<tbody><tr>
<th rowspan="2">Предмет</th>
<th colspan="17">Январь</th>
<th colspan="21">Февраль</th>
<th colspan="2">Март</th>
<th rowspan="2">Средняя оценка</th>
</tr>
<tr>
<th>10</th>
<th>11</th>
<th>12</th>
<th>13</th>
<th>14</th>
<th>15</th>
<th>17</th>
<th>19</th>
<th>20</th>
<th>21</th>
<th>24</th>
<th>25</th>
<th>26</th>
<th>27</th>
<th>28</th>
<th>29</th>
<th>31</th>
<th>1</th>
<th>2</th>
<th>3</th>
<th>4</th>
<th>5</th>
<th>7</th>
<th>8</th>
<th>9</th>
<th>10</th>
<th>11</th>
<th>12</th>
<th>14</th>
<th>16</th>
<th>17</th>
<th>19</th>
<th>21</th>
<th>22</th>
<th>24</th>
<th>25</th>
<th>26</th>
<th>28</th>
<th>1</th>
<th>2</th>
</tr>
<tr>
<td class="cell-text">Английский язык</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
5
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
5
</td>
<td>
</td>
<td>
</td>
<td>
5
</td>
<td>
</td>
<td>
5
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
5
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="cell-num">5</td>
</tr>
<tr>
<td class="cell-text">Литература</td>
<td>
</td>
<td>
</td>
<td>
5
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
5
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
ОТ
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td>
</td>
<td class="cell-num">5</td>
</tr>
</tbody></table>
import sys
from bs4 import BeautifulSoup
DOC = 'test.html'
try:
with open(DOC, encoding='utf-8') as f:
page = f.read()
except IOError as err:
print(f'Error reading the file {DOC}: {err}')
sys.exit()
soup = BeautifulSoup(page, 'lxml')
rows = soup.find_all('tr')
rows = [row.find_all('td') for row in rows]
rows = [row for row in rows if row]
for row in rows:
columns = [cell.text.strip() for cell in row]
columns = [cell for cell in columns if cell]
print(f'{columns[0]}:', *columns[1:-1], f'Ср: {columns[-1]}')