Get the App
SLTechnology News&Howtos  ›  Development  › 

How to use map in format in python

Shulou Source: shulou.com Published: 2022-06-03 15:18:05 10月01日 Update

In this issue, the editor will bring you about the use of map in python's format. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.

1. Format_map can only use variable data parameters to map relational data such as dictionaries in string format.

2. Grammar

Str.format_map (mapping)

3. Parameters, data of mapping dictionary type.

4. Returns the formatted string.

Example

Weather = "sunny day" hours = 7s = "the weather today is {weather}, and the time is now {hours} exactly." s.format_map (vars ()) above is the use of map in the format of python shared by the editor. If you happen to have similar doubts, please refer to the above analysis to understand. If you want to know more about it, you are welcome to follow the industry information channel.

Tags: Data usage method content parameters dictionary character string format analysis specialty small and medium rich content weather examples that is articles sunny days more present tense Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Docker Microsoft Redmi NVidia Shulou Information