在下面的脚本中,'a'全局设置为TC-01,b全局设置为'Passed',但执行后我能够获得值' '但是'b'价值我无法得到,所以请给我提供有价值的想法,以获得'B'的价值。如何在内部调用python global命令另一个文件的步骤
import HTML
import html2
from html2 import a,b
file = open('out.html', 'w')
# dictionary of test results, indexed by test id:
test_results = {
a: 'b',-----> In this only a value is take , b is not taking the value.
#'Testcase-005': 'success'
#'Testcase-005': 'error',
}
result_colors = {
'passed': 'lime',
'failed': 'red',
'error': 'yellow',
}
t = HTML.Table(header_row=['Testcase - ID', 'Result'])
for test_id in sorted(test_results):
#create the colored cell:
print test_results
color = result_colors[test_results[test_id]]
colored_result = HTML.TableCell(test_results[test_id], bgcolor=color)
#append the row with two cells:
t.rows.append([test_id, colored_result])
htmlcode = str(t)
c=htmlcode
print htmlcode
file.write(c)
正常工作... – Anub 2013-05-21 07:04:29