我是 ac coder,但是 python 是不同的,我遇到了一个问题
items = [
["/ank/homepage.py","Home"],
["/ank/package.py","Packages"],
["/status.py","Status"],
["/task.py","Task"],
["/report.py","Report"]
]
static_html='<table id="main_nav" align="center"><tr>'
for each_item in items:
if each_item in items:
if isinstance(each_item, list):
static_html= static_html + '<td><a href=" ', each_item[0], ' "> ', each_item[1], ' </a></th> '
static_html+='</tr></table>'
print static_html
然后,IDE 向我发送错误 /usr/bin/python2.7
/home/tsuibin/code/aps/dxx/test_tmp.py
Traceback (most recent call last):
File "/home/tsuibin/code/aps/dxx/test_tmp.py", line 39, in <module>
printMainNavigation()
File "/home/tsuibin/code/aps/dxx/test_tmp.py", line 20, in printMainNavigation
static_html= static_html + '<td><a href=" ', each_item[0], ' "> ', each_item[1], ' </a></th> '
TypeError: can only concatenate tuple (not "str") to tuple
Process finished with exit code 1