代码块一:
#A1 A2 A3 ... C1 C2 C3
s1 = 'ABC'
s2='123'
print([i + j for i in 'ABC' for j in '123'])
示例一及运行结果:
代码块二:
li = [
[1,2,3],
[4,5,6],
[7,8,9]
]
#[1,2,3,4,5,6,7,8,9]
resultli = []
for item1 in li:
for item2 in item1:
resultli.append(item2)
print(resultli)
print([item2 for item1 in li for item2 in item1])
示例二及运行结果: