-5
我将元素列表存储在列表中,我想创建一个if语句,以便我可以将一个字符串与列表进行比较以查看元素是否不匹配。检查元素是否是列表中的最后一个
下面是我用:
self.EPG_Channel = 'Channel 5'
self.channel_str = ['BBC One, BBC Two, ITV, Channel 4, Channel 5']
我想创造的东西是这样的:
if not self.EPG_Channel == self.channel_str:
print "You are not in the last element in the list"
else:
print "You are in the list element in the list so let do nothing..."
我想知道你如何创建一个if语句来检查在列表中的元素用字符串来查看元素是否不在列表中的最后一个元素中?
这是我所期待的。谢谢!!!!!!! –