Relative Content

Tag Archive for pythonf-string

How can I set a python f-string format programmatically?

I would like to set the formatting of a number in an fstring programmatically. Specifically, I have an integer that can span several orders of magnitude and I’d like to print it using the underscore “_” delimiter, e.g.

Return Output from Function on Multiple Lines

I’ve tried to figure this out on my own, but I’m coming to a dead end. I’m trying to return a string from a function that I created that references amounts derived from a pandas dataframe that was created earlier in the function, and I want each variable reference to be shown as it’s own line as the output: