Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # obj print
- info = {
- 'name': 'Neymar',
- 'age': 26,
- 'pos': 'forwrd',
- 'country': 'brazil',
- 'club': 'psg'
- }
- # sen = 'name is: ' + info['name'] + ' ,age is: ' + str(
- # info['age']) + ' ,position is: ' + info['pos'] + ' ,country: ' + info['country'] + ' ,club: ' + info['club']
- # print(sen)
- # or,
- # sen = 'name is: {}, age is: {}, position is: {}, country: {}, club: {}'.format(
- # info['name'], info['age'], info['pos'], info['country'], info['club'])
- # print(sen)
- # class info1():
- # def __init__(self, name, age):
- # self.name = name,
- # self.age = age
- # inf = info1('neymar', '26')
- # res = 'name: {0.name} , age: {0.age}'. format(inf)
- # print(res)
- # number format
- # py = 3.14159
- # res = 'pi is equal to {:.2f}'.format(py)
- # print(res)
- gb = 1024
- res = '1 gb = {:,} kb'.format(gb ** 2)
- print(res)
Advertisement
Add Comment
Please, Sign In to add comment