140. String Zfill and Format_map Method in Python with Example Code || Python String Methods-22

Published: 06 October 2022
on channel: Bhavatavi
14
0

Code:
text='program is fun'
print(text.zfill(15))
print(text.zfill(20))
print(text.zfill(10))

number='-690'
print(number.zfill(8))
number='+690'
print(number.zfill(8))
text='--random_text'
print(text.zfill(20))
#map()
point={'x':9,'y':-6}
print('{x}{y}'.format(**point))

point={'x':9,'y':-6,'z':0}
print('{x}{y}{z}'.format(**point))

#dict subclass
class Coordinate(dict):
def __missing__(self,key):
return key


print('({x}, {y})'.format_map(Coordinate(x='9')))
print('({x}, {y})'.format_map(Coordinate(x='5')))
print('({x}, {y})'.format_map(Coordinate(x='9',y='6')))


On this page of the site you can watch the video online 140. String Zfill and Format_map Method in Python with Example Code || Python String Methods-22 with a duration of hours minute second in good quality, which was uploaded by the user Bhavatavi 06 October 2022, share the link with friends and acquaintances, this video has already been watched 14 times on youtube and it was liked by 0 viewers. Enjoy your viewing!