我在显示一些文字时出现了轻微的修饰问题。下面的代码显示一些温度,其后缀为F或C,具体取决于变量LineValue [0]。但是,输出看起来有些奇怪。由于某种原因,度数标记实际上看起来比文本大一点,并且在任何情况下显示看起来都有些偏离。我想做的是显示度标记,该度标记比主要文本略小,例如大约为打印语句中前一个文本的3/4。一个设置为65px,另一个设置为108px。
index.txt:
div.Out {
position: fixed;
top: 45;
left: 510;
width: 300px;
font: bold 65px Lora;
color: white;
}
div.In {
position: fixed;
top: 214;
left: 127;
width: 400px;
font: bold 108px Lora;
color: rgb(0,44,255);
index.cgi:
with open("/usr/lib/cgi-bin/index.txt","r") as f:
x = f.read()
print(x)
print('<div class="Out">')
print('{0:5.1f}'.format(Tout), ClassValues[0][LineValue[0]])
print(</div)
print('<div class="In">')
if LineValue[0] == 0:
Temperature = float(subprocess.check_output(["/usr/local/sbin/bme280", "-C"])) + COffset # Print Temperature in degrees Celsius
print('{0:5.1f}'.format(Temperature), ClassValues[0][0])
else:
Temperature = float(subprocess.check_output(["/usr/local/sbin/bme280", "-F"])) + FOffset # Print Temperature in degrees Farenheight
print(Temperature, ClassValues[0][1])
print('</div>')
ClassValues [0]的值为[℃,℉]
Python代码输出:
<div class="Out">
25.8 ℃
</div>
<div class="In">
25.3 ℃
答案 0 :(得分:0)
这有效:
last_value(cccc) IGNORE NULLS OVER (PARTITION BY grp_close ORDER BY date)
答案 1 :(得分:0)
将温度单位包装为标签+ CSS
div.In {
width: 400px;
font: bold 108px Lora;
}
mySmall {
font-size: 50px
}
<div class="In">
25.8 <small>℃</small>
</div>
<div class="In">
25.8 <mySmall>℃</mySmall>
</div>