循环遍历2个列表并将其插入到f字符串Python中

循环遍历2个列表并将其插入到f字符串Python中,python,list,loops,for-loop,Python,List,Loops,For Loop,我正在寻找一种在一个f字符串中插入两个python列表的方法。 我已经尝试了很多解决方案,包括这个:,但似乎都做不好 我已经尝试了“.join”方法,但我想我在某个地方犯了一个错误,因为它适用于1个列表,但不适用于两个列表 目标如下: list1 = ['a', 'b', 'c', 'd', 'e',] list2 = ['apple', 'banana', 'citrus', 'denim', 'entry',] print(f'I want the items of {list1} a

我正在寻找一种在一个f字符串中插入两个python列表的方法。 我已经尝试了很多解决方案,包括这个:,但似乎都做不好

我已经尝试了“.join”方法,但我想我在某个地方犯了一个错误,因为它适用于1个列表,但不适用于两个列表

目标如下:


list1 = ['a', 'b', 'c', 'd', 'e',]

list2 = ['apple', 'banana', 'citrus', 'denim', 'entry',]

print(f'I want the items of {list1} and {list2}')

我想要的输出:


'I want the items of a and apple'
'I want the items of a and banana'
'I want the items of a and citrus'

etc.

'I want the items of a and apple'
'I want the items of b and apple'
'I want the items of c and apple'

所以,我基本上希望列表1和列表2的所有可能性都在一个字符串中。在我的示例中,这将导致25个字符串。我似乎做得不对,但我认为我走对了方向

谢谢

您可以使用

输出:

I want the items of a and apple
I want the items of a and banana
I want the items of a and citrus
I want the items of a and denim
I want the items of a and entry
I want the items of b and apple
I want the items of b and banana
I want the items of b and citrus
I want the items of b and denim
I want the items of b and entry
I want the items of c and apple
I want the items of c and banana
I want the items of c and citrus
I want the items of c and denim
I want the items of c and entry
I want the items of d and apple
I want the items of d and banana
I want the items of d and citrus
I want the items of d and denim
I want the items of d and entry
I want the items of e and apple
I want the items of e and banana
I want the items of e and citrus
I want the items of e and denim
I want the items of e and entry

你是上帝!谢天谢地!
I want the items of a and apple
I want the items of a and banana
I want the items of a and citrus
I want the items of a and denim
I want the items of a and entry
I want the items of b and apple
I want the items of b and banana
I want the items of b and citrus
I want the items of b and denim
I want the items of b and entry
I want the items of c and apple
I want the items of c and banana
I want the items of c and citrus
I want the items of c and denim
I want the items of c and entry
I want the items of d and apple
I want the items of d and banana
I want the items of d and citrus
I want the items of d and denim
I want the items of d and entry
I want the items of e and apple
I want the items of e and banana
I want the items of e and citrus
I want the items of e and denim
I want the items of e and entry