什么是 content%args.__dict__?

Evg*_*eny 0 python dictionary python-2.7

我对此处帖子中的声明感到困惑:

with open('cover.tex','w') as f:
    f.write(content%args.__dict__)
Run Code Online (Sandbox Code Playgroud)

到底是什么content%args.__dict__?这是Python 2.7 吗?快速谷歌搜索/询问没有帮助。

更新:一个建议是%除法,它如何应用于字符串?

Boa*_*les 5

content包含以下形式的字符串这里的"%(key)s"运算%符是字符串插值运算符,它将导致 的值args.__dict__["key"]被替换"%(key)s"到写出的字符串中。