#!/usr/bin/env python3# -*- coding: utf-8 -*-format_one = '{0}, {1}'.format('Windrivder', 21)format_two = '{name}, {age}'.format(age=18, name='Windrivder')class Person(object):"""docstring for Person."""def __init__(self, name, age):self.name = nameself.age = agedef __str__(self):return 'This guy is {self.name}, is {self.age} years old'.format(self=self)format_three = '{:15} | {:^9} | {:^9}'.format('', 'lat', 'lng')format_four = '{:15} | {:9.4f} | {:9.4f}'.format('Tokyo', -23.547778, -46.635833)format_five = '{:b}, {:d}, {:o}, {:x}'.format(17, 17, 17, 17)format_six = '{:,}'.format(1234567890)if __name__ == '__main__':print(format_one)print(format_two)print(format_three)print(format_four)print(format_five)print(format_six)print(str(Person('Windrivder', 22)))
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。