preparations for hw
This commit is contained in:
@@ -1,37 +0,0 @@
|
|||||||
import csv
|
|
||||||
|
|
||||||
def create_html_table_from_csv(csv_path, html_path):
|
|
||||||
try:
|
|
||||||
with open(csv_path, 'r', newline='', encoding='utf-8') as csv_file:
|
|
||||||
reader = csv.reader(csv_file)
|
|
||||||
header = next(reader)
|
|
||||||
|
|
||||||
with open(html_path, 'w', encoding='utf-8') as html_file:
|
|
||||||
html_file.write('<table class="data-table">\n')
|
|
||||||
|
|
||||||
html_file.write('<thead>\n')
|
|
||||||
html_file.write('<tr>\n')
|
|
||||||
for column_header in header:
|
|
||||||
html_file.write(f'<th>{column_header}</th>\n')
|
|
||||||
html_file.write('</tr>\n')
|
|
||||||
html_file.write('</thead>\n')
|
|
||||||
|
|
||||||
html_file.write('<tbody>\n')
|
|
||||||
for row in reader:
|
|
||||||
html_file.write('<tr>\n')
|
|
||||||
for cell in row:
|
|
||||||
html_file.write(f'<td>{cell}</td>\n')
|
|
||||||
html_file.write('</tr>\n')
|
|
||||||
html_file.write('</tbody>\n')
|
|
||||||
|
|
||||||
html_file.write('</table>\n')
|
|
||||||
|
|
||||||
print(f"Successfully created {html_path} from {csv_path}")
|
|
||||||
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
csv_file_name = 'temp_sensor_data.csv'
|
|
||||||
html_file_name = 'test.html'
|
|
||||||
create_html_table_from_csv(csv_file_name, html_file_name)
|
|
||||||
197
index.css
197
index.css
@@ -1,197 +0,0 @@
|
|||||||
/* menu part */
|
|
||||||
.menu {
|
|
||||||
border-top: double thick silver;
|
|
||||||
border-bottom: double thick silver;
|
|
||||||
font-size: 0;
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: repeat(7, min-content);
|
|
||||||
grid-template-rows: 1fr;
|
|
||||||
justify-items: start;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.menu-item {
|
|
||||||
display: inline-block;
|
|
||||||
width: max-content;
|
|
||||||
height: 3em;
|
|
||||||
line-height: 3em;
|
|
||||||
/* to align to center */
|
|
||||||
text-align: center;
|
|
||||||
vertical-align: middle;
|
|
||||||
padding: 0 10px;
|
|
||||||
margin: 0 10px;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
font-size: medium;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.menu .selected {
|
|
||||||
color: green;
|
|
||||||
font-weight: bold;
|
|
||||||
border-left: double 4px silver;
|
|
||||||
border-right: double 4px silver;
|
|
||||||
}
|
|
||||||
|
|
||||||
.menu .menu-header {
|
|
||||||
color: green;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
.menu a {
|
|
||||||
color: black;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@media screen and (max-width: 800px) {
|
|
||||||
.menu {
|
|
||||||
grid-template-columns: 1fr 1fr;
|
|
||||||
grid-template-rows: 1fr 1fr 1fr;
|
|
||||||
justify-items: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.menu .selected {
|
|
||||||
border-bottom: double thick silver;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* 3 images part */
|
|
||||||
.images-container {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
width: 90%;
|
|
||||||
margin: auto;
|
|
||||||
}
|
|
||||||
|
|
||||||
.images-container>img {
|
|
||||||
margin: auto;
|
|
||||||
width:100%;
|
|
||||||
border: thin solid black;
|
|
||||||
}
|
|
||||||
|
|
||||||
.images-container>img:nth-child(2n+1) {
|
|
||||||
margin-top: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: 800px) {
|
|
||||||
.images-container {
|
|
||||||
display: inline-flex;
|
|
||||||
flex-direction: column;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.images-container>img {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
.images-container>img:nth-child(2n+1) {
|
|
||||||
margin-top: 0px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* text block part */
|
|
||||||
.info-block-header {
|
|
||||||
display: block;
|
|
||||||
font-weight: bold;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
|
|
||||||
.block-border {
|
|
||||||
border: solid thin black;
|
|
||||||
padding: 2vw;
|
|
||||||
margin: 1vw 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
.block-a-container {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 3fr 3fr 2fr;
|
|
||||||
grid-template-rows: 1fr;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: 800px) {
|
|
||||||
.block-a-container {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.block-b-container {
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 4fr 7fr 4fr;
|
|
||||||
grid-template-rows: 1fr;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: 800px) {
|
|
||||||
.block-b-container {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
.h-block>* {
|
|
||||||
margin: 2vw;
|
|
||||||
}
|
|
||||||
|
|
||||||
.h-block>span,
|
|
||||||
.h-block>div {
|
|
||||||
text-align: justify;
|
|
||||||
}
|
|
||||||
|
|
||||||
.h-block>img {
|
|
||||||
margin: auto;
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
/*small articles part*/
|
|
||||||
.main-right{
|
|
||||||
border-left: thin solid black;
|
|
||||||
margin: 30px 0 0 50px;
|
|
||||||
|
|
||||||
}
|
|
||||||
.small-info-block{
|
|
||||||
margin: 20px 10px 0 ;
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 1fr 1fr;
|
|
||||||
grid-template-rows: auto;
|
|
||||||
}
|
|
||||||
@media screen and (max-width: 1000px) {
|
|
||||||
.small-info-block {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.small-info-block-header{
|
|
||||||
display: block;
|
|
||||||
font-weight: bold;
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
|
|
||||||
.small-info-block-image >img{
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
||||||
.small-info-block-text {
|
|
||||||
text-align: justify;
|
|
||||||
}
|
|
||||||
.small-info-block-text >a{
|
|
||||||
display: block;
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
/*main part*/
|
|
||||||
.main{
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 3fr 1fr;
|
|
||||||
grid-template-rows: 1fr;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media screen and (max-width: 800px) {
|
|
||||||
.main {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -3,6 +3,9 @@
|
|||||||
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
<link href="css/bootstrap.min.css" rel="stylesheet">
|
||||||
|
<script src="js/bootstrap.bundle.min.js"></script>
|
||||||
<title>
|
<title>
|
||||||
"Portfolio"
|
"Portfolio"
|
||||||
</title>
|
</title>
|
||||||
@@ -140,6 +143,7 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user