0
我想结合以下两个列表,但组合1a除外。python中既没有也没有声明
a=[1,2,3,4,5,6,7,8,9]
b=['a', 'b', 'c','d', 'e','f','g']
c=[]
for i in a:
for j in b:
if i is not 1 and j is not'a':
c.append(str(i) + j)
print c
这排除了1和'a'的所有组合。我怎样才能排除1a
决不比较整数或'is'浮动。使用'=='和'!='。 –
布尔代数101,德摩根定律。 – njzk2