Unpacking lists in a f string

Paulo da Silva p_d_a_s_i_l_v_a_ns at nonetnoaddress.pt
Wed Feb 9 13:13:33 EST 2022


Às 02:17 de 09/02/22, Paulo da Silva escreveu:
> Hi!
> 
> Let's say I have two lists of equal length but with a variable number of 
> elements. For ex.:
> 
> l1=['a','b','c']
> l2=['j','k','l']
> 
> I want to build a string like this
> "foo a j, b k, c l bar"
> 
> Is it possible to achieve this with f strings or any other 
> simple/efficient way?
> 
> Thanks for any help/comments.

Thank you for your responses.


More information about the Python-list mailing list