Re: Unpacking lists in a f string

2022-02-09 Thread Kirill Ratkin
Hi. Try this: f"foo {','.join([f'{a} {b}' for a,b in list(zip(l1,l2))])} bar" 09.02.2022 21:13, Paulo da Silva пишет: À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'

Re: Unpacking lists in a f string

2022-02-09 Thread Paulo da Silva
À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 ot

Re: Unpacking lists in a f string

2022-02-09 Thread David Lowry-Duda
> 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? Here is a small list of things that want to be done (and natural ways to perform them) 1. pair items in th

Re: Unpacking lists in a f string

2022-02-09 Thread Python
Paulo da Silva wrote: 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

Unpacking lists in a f string

2022-02-09 Thread Paulo da Silva
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