VOOZH about

URL: https://www.geeksforgeeks.org/python/python-string-format_map-method/

⇱ Python String format_map() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Python String format_map() Method

Last Updated : 5 Aug, 2021

Python String format_map() method is an inbuilt function in Python, which is used to return a dictionary key's value.

Syntax: 

string.format_map(z)

Parameters: 

Here z is a variable in which the input dictionary is stored and string is the key of the input dictionary. input_dict: Takes a single parameter which is the input dictionary.

Returns: 

Returns key's values of the input dictionary.

Example 1: Python String format_map() method

Output: 

John's last name is Wick

Example 2:

Output: 

geeksforgeeks b

Example 3:

Output: 

Barry is an Engineer and he is 30 years old.
Bruce is an Doctor and he is 31 years old.

Example 4: Practical Application

The format_map() function can be used in any practical application.

Output: 

George has 10 new messages
Comment