Home > OS >  In Matplotlob writing mathematical expressions with f-literals; how to deal with the raise to the po
In Matplotlob writing mathematical expressions with f-literals; how to deal with the raise to the po

Time:04-28

I want to display certain equations on a Matplotlob plot. Following Plot with equations

So how to reproduce the same results with s2 or s3 as s1 when using f-string literals?

CodePudding user response:

In the f-string, curly braces need to be represented by two layers, so you need three layers to meet your requirements:

>>> a = 100
>>> f'{{a}}'
'{a}'
>>> f'{{{a}}}'
'{100}'
  • Related