[Level 2] Replace doc by variable name in Python.
#!/bin/env python
doc = '''
a: %(a)s
b: %(b)s
c: %(c)s
d: %(d)s
'''
dict = {
'a': 'a1',
'b': 'b1',
'c': 'c1',
'd': 'd1',
}
print doc % dict
$ /tmp/t.py a: a1 b: b1 c: c1 d: d1 $Wish this helps. regards, Stanley Huang
Comments
Post a Comment