From dogan, 10 Months ago, written in Python.
Embed
  1. def foo(text, *args):
  2.     return text.format((len(args)*'{}, ').format(*args))
  3.    
  4.  
  5. txt = 'There are many {} in the universe.'
  6. print(foo(txt, 'stars', 'galaxies', 'nebulas'))
  7.  
  8. # >> There are many stars, galaxies, nebulas,  in the universe

Replies to format string rss

Title Name Language When
Re: format string dogan python 10 Months ago.