On 16/03/2019 18:44, Peter Otten wrote:
>
> In Python 3.6 and above you can use f-strings:
> 
>>>> d = dict(a="hello", b="world")
>>>> " ".join(f'{k} "{v}"' for k, v in d.items())
> 'a "hello" b "world"'

Cool, I'd missed f-strings. Time for some reading....

Thanks Peter,


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to