Formatting floats as strings inside a list comprehension
Never thought of this, but I can use f-strings inside list comprehensions inside f-strings:
logger.info(f"Stories split into {'/'.join(f'{x:.2f}' for x in actual_split_sizes)}")
(Not that it’s necessarily a good idea to.)
Nel mezzo del deserto posso dire tutto quello che voglio.
comments powered by Disqus