单元格的条件格式和电子邮件

时间:2016-11-30 07:15:32

标签: python

我们在python中创建了一个脚本,用于自动登录Linux服务器并准备数据和日常工作。

我们正在阅读nds_error文件并准备一张桌子。我的要求是制定一个条件,如果表格中的任何单元格不包含字符串" Ok",那么它将以颜色突出显示。

f = open('/home/nds_error')
lines = f.readlines()
count=len(lines)
f.close()

body1="""

"""

z=0

while (z<count):
  test = lines[z]
  hello = test.split('|')
  a = hello[0:1]
  a1 = a[0]
  b = hello[1:2]
  b1 = b[0]
  c = hello[2:3]
  c1 = c[0]
  d = hello[3:4]
  d1 = d[0]
  e = hello[4:5]
  e1 = e[0]
  f = hello[5:6]
  f1 = f[0]
  g = hello[6:7]
  g1 = g[0]

  body1 = body1 + '<tr><td style="font-family:Calibri;"><b>' + a1 + '</b></td><td style="font-family:Calibri;">' + b1 + '</td></td><td style="font-family:Calibri;">' + c1 + '</td></td><td style="font-family:Calibri;">' + d1 + '</td></td><td style="font-family:Calibri;">' + e1 + '</td></td><td style="font-family:Calibri;">' + f1 + '</td></td><td style="font-family:Calibri;">' + g1 + '</td></tr>'
  z=z+1

start1="""

<table border="3">
<tr style="font-family:Bell MT;font-size:120%;color:#360E9B">
<caption><b>One-NDS Nodes</b></caption>
  <th style="font-family:Bell MT;font-    size:92%;color:#360E9B;">PGD/RDS/BDS</th>

<table border="3">
<tr style="font-family:Bell MT;font-size:120%;color:#360E9B">    
<caption><b>One-NDS Nodes</b></caption>
  <th style="font-family:Bell MT;font-    size:92%;color:#360E9B;">PGD/RDS/BDS</th>


  <th style="font-family:Bell MT;font-size:92%;color:#360E9B;">Disk Space Utilization > 40%</th>
 <th style="font-family:Bell MT;font-size:92%;color:#360E9B;">CPU Load > 40%</th>
 <th style="font-family:Bell MT;font-size:92%;color:#360E9B;">Link status with other DS Node</th>
 <th style="font-family:Bell MT;font-size:92%;color:#360E9B;">DS nodes SYNC status</th>
 <th style="font-family:Bell MT;font-size:92%;color:#360E9B;">DS Load stats (0 rejects)</th>
 <th style="font-family:Bell MT;font-size:92%;color:#360E9B;">Backup</th>
</tr>

"""

end1 = """
</table>
<br>
"""

0 个答案:

没有答案