What is Single Formatter in Python?

comentários · 191 Visualizações

This Blog will explain about Format Function in Python

Formatters are used to fix the one or more placeholder fields, or placeholders that are defined by a pair of curling brackets "{}" to strings and then using str. format() method. You'll have to enter to the format() method the value you want to join using the string. The value will be displayed in the exact place that your placeholder {} position at the time you launch the program. Single formatters are defined as those that use only single placeholder. In the following example, you'll be able see how the format is implemented inside the print statements.

Apart from directly using in the print statement, we can also use format() to a variable:

EXAMPLE:

1

print("{} is a good for beginners in python".format("This Book"))

 

Output:   This Book is a good for beginners in python

 

Learn and explore More about Python ,check out this Online Python Course.

comentários