Using string.format instead of %

This commit is contained in:
Manuel Ebert 2012-05-30 17:50:37 +02:00
parent 2944fc85e8
commit 8a28afc7bd

View file

@ -26,12 +26,12 @@ class Entry:
body = body_wrapper + self.body.strip() body = body_wrapper + self.body.strip()
space = "\n" space = "\n"
return "%(date)s %(title)s %(body)s %(space)s" % { return "{date} {title} {body} {space}".format(
'date': date_str, date=date_str,
'title': self.title, title=self.title,
'body': body, body=body,
'space': space space=space
} )
def __repr__(self): def __repr__(self):
return str(self) return str(self)
@ -51,10 +51,10 @@ class Entry:
space = "\n" space = "\n"
md_head = "###" md_head = "###"
return "%(md)s %(date)s, %(title)s %(body)s %(space)s" % { return "{md} {date}, {title} {body} {space}".format(
'md': md_head, md=md_head,
'date': date_str, date=date_str,
'title': self.title, title=self.title,
'body': body, body=body,
'space': space space=space
} )