这怎么让他们接上?Python3笛卡尔积与查找字母替换文字?

from itertools import product

L1 = list("abcd")
L2 = list("+-*/")
L3 = list("x")
L4 = list("=><≈")
L5 = list("1")


l = []
for X2,X3,X4,X5,X1 in product(L2,L3,L4,L5,L1):
    s = X1+X2+X3+X4+X5
    l.append(s.replace(" ", ""))

n = 1
for i in l:
    if n%4 == 0:
        print(i)
    else:
        print(i, end ='')
    n = n + 1


中间接不上,怎么等于n循环笛卡尔积的结果?

f=l
print(f,end = "\t")
a = ["a", "b"] # 准备查找替换的词
b = ["一", "我"] #替换者
 
import re # 导入库
dic = dict(zip(a,b)) #替换字典
pattern = re.compile('(' + '|'.join(a) + ')')
s = pattern.sub(lambda g:dic[g.group()],k)
print(s)

有点不明白,后半部分的意思

from itertools import product
 
L1 = list("abcd")
L2 = list("+-*/")
L3 = list("x")
L4 = list("=><≈")
L5 = list("1")
 
 
l = []
for X2,X3,X4,X5,X1 in product(L2,L3,L4,L5,L1):
    s = X1+X2+X3+X4+X5
    l.append(s.replace(" ", ""))
 
n = 1
t = ''
res = []
for i in l:
    t += i + ' '
    if n%4 == 0:
        print(i)
        res.append(t)
        t = ''
    else:
        print(i, end =' ')
    n = n + 1


s = '\n'.join(res) #用空格相接也可以: s = ' '.join(res)
print(s)