D
D
DontQuantum2021-10-13 19:50:22
Python
DontQuantum, 2021-10-13 19:50:22

Why does python 3 have a format function for strings?

How is "{}".format('hello world') different from f"{number}" ?
It is more convenient for me to use f"{number}", but the thought creeps in that suddenly it is more expensive in terms of performance

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander, 2021-10-13
@DontQuantum

f notation, introduced in python 3.6, earlier versions had .format . There are no functional differences, there is a difference in readability and conciseness, I use the f notation.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question