3

I want to add the data of my changes list to this string --> row

I can do it manually and this works, but I want to do it in a loop. Can someone help?

What I have tried:

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"])

Manually its like this:

        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"])
1
  • what changes_dict containing? Commented Nov 26, 2020 at 9:21

1 Answer 1

1

You can try:

*changes[key]

instead of

for item in changes:
  changes[key][item]
Sign up to request clarification or add additional context in comments.

1 Comment

Sorry it was my fault, changes is a dict like changes_dict just with a new mapping 1=X 0 = -

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.