我想将我的changes
列表的数据添加到这个字符串中 --> row
我可以手动完成它,这个方法可行,但我希望用循环来实现。有人能帮忙吗?
我尝试过以下方法:
changes_dict.items {'update':[1], 'history':[0]} # this is also generated generic this is just an example
changes = {'update':["x"], 'history':["-"]} #-> this is dict with lists created generic and always changes
for key, value_list in changes_dict.items():
row = " * {:<13} {:<11} {:<10} {:-<1} {:-<1} {:-<1} {:-<1} {:-<1} {:-<1} {:<23}".format(
ID,
log_request["date"],
log_request["author"],
for item in changes:
changes[key][item]
log_request["description"])
手动操作如下:
row = " * {:<11} {:<11} {:<10} {:-<1} {:-<1} {:-<1} {:-<1} {:-<1} {:-<1} {:<23}".format(
ID,
log_request["date"],
log_request["author"],
changes[key][0],
changes[key][1],
changes[key][2],
changes[key][3],
changes[key][4],
changes[key][5],
merge_request["description"])
changes_dict
包含什么内容? - Harsha Biyani