Skip to content

字符串格式化和format #5

@damnever

Description

@damnever

字符串格式化和format

format在许多方面看起来更便利.你可以重用参数,但是你用%就不行

你确定???

>>> data = {'name': 'Bob', 'age': 20}
>>> '%(name)s is %(age)d years old, and %(name)s is a boy.' % data
'Bob is 20 years old, and Bob is a boy.'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions