str = '''
123
abc
+-/
'''
# 转列表
# print:
1a+
1a-
1a/
……
str = '''
123
abc
+-/
'''
arr = [list(x) for x in str.splitlines() if x]
from itertools import product
arr = list(product(*arr))
for a in arr:
print(''.join(a))
输出:
1a+
1a-
1a/
1b+
1b-
1b/
1c+
1c-
1c/
2a+
2a-
2a/
2b+
2b-
2b/
2c+
2c-
2c/
3a+
3a-
3a/
3b+
3b-
3b/
3c+
3c-
3c/
from itertool inport product
Str = "
123
abc
+-/
"
arr = filter(None, Str.splitlines())
Res = map(lambda char : ''.join(char), prpduct(*arr))
print(list(Res))