I am newbie in html/css so and having question about data showing in html format. What i have is a long list which i want to split and show in html format as two separate columns.For example instead of:
Col1 Col2
1 a
2 a
3 a
4 a
5 b
6 b
7 b
8 b
I want to see text as
Col1 Col2 Col1 Col2
1 a 5 b
2 a 6 b
3 a 7 b
4 a 8 b
How should my html/css code should look like to have that data above in a splitted table?
For the first output,seeing all data in 2 columns in one table i am using code python:
start = '''<html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"></meta></head> '''
font_size = '14pt'
style = '''<style media="screen" type="text/css">
table.table1 {
border-collapse: collapse;
width: 20%;
font-size: '''+font_size+''';
}
td {
text-align: left;
border: 1px solid #ccc;
}
th {
text-align: left;
border: 1px solid #ccc;
background-color: #072FB1;
}
</style>
'''
title = '''<div align="center"></br><font size = "24"><strong>'''+title+'''</strong></font></br></br></</div>'''
df_data1 = df_data[1:10]
data = df_data1.to_html( index = False, na_rep ='' )
data = data.replace('None', '')
style_headers = 'background-color: #072FB1; color: #ffffff;'
style_status_new ='background-color: #587EF8; color: #ffffff;font-weight:bold'
style_first_col = 'font-weight:bold;'
total = 'TOTAL'
soup = bs4.BeautifulSoup(data)
soup.thead.tr.attrs['style'] = style_headers
html = start+lentos+style+'''<body bgcolor="#FFFFFF">'''+title+time+unicode.join(u'\n',map(unicode,soup))+finish
try:
with open(dir_files+'engines_tv_html.html', 'w') as file:
file.write(html.encode('UTF-8'))
except Exception, e:
log_error()
Where in df_data[1:10] i am splitting my data to separate data_frames. So the question is to see splitted data_frame(one table in the left and another in on the right) in one html page
Aucun commentaire:
Enregistrer un commentaire