[ACCEPTED]-Python 3.2: How to pass a dictionary into str.format()-keyword-argument
Accepted answer
This does the job:
stats = { 'copied': 5, 'skipped': 14 }
print( 'Copied: {copied}, Skipped: {skipped}'.format( **stats ) ) #use ** to "unpack" a dictionary
For more info please refer 1 to:
you want .format(**stats)
as that makes stats part of format's 1 kwargs.
Source:
stackoverflow.com
More Related questions
Cookie Warning
We use cookies to improve the performance of the site. By staying on our site, you agree to the terms of use of cookies.