# Načítanie zamestnancov zo súboru
with open('zamestnanci.txt', 'r', encoding='utf-8') as file:
lines = file.readlines()
zamestnanci = [line.strip() for line in lines]
# Vytvorenie HTML súboru
html_content = """
<!DOCTYPE html>
<html lang="sk">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Zoznam zamestnancov</title>
</head>
<body>
<h1>Zoznam zamestnancov</h1>
<table border="1">
<tr>
<th>#</th>
<th>Meno a priezvisko</th>
</tr>
"""
for index, zamestnanec in enumerate(zamestnanci, start=1):
html_content += f"""
<tr>
<td>{index}</td>
<td>{zamestnanec}</td>
</tr>
"""
html_content += """
</table>
</body>
</html>
"""
# Zápis do HTML súboru
with open('zamestnanci.html', 'w', encoding='utf-8') as file:
file.write(html_content)
print("HTML súbor bol vygenerovaný ako 'zamestnanci.html'.")
<!DOCTYPE html>
<html lang="sk">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Zoznam zamestnancov</title>
</head>
<body>
<h1>Zoznam zamestnancov</h1>
<table border="1">
<tr>
<th>#</th>
<th>Meno a priezvisko</th>
</tr>
<tr>
<td>1</td>
<td>Lubomir Neviem</td>
</tr>
<tr>
<td>2</td>
<td>Ako Novak</td>
</tr>
<tr>
<td>3</td>
<td>Lojzo Novotny</td>
</tr>
</table>
</body>
</html>