J'ai un tableau qui a 1 élément. Cet élément contient: impression (results_read [0])Python vérifier si l'élément de tableau contient la chaîne
[(u'n04019541', u'puck', 0.57829314), (u'n02974003', u'car_wheel', 0.24903433), (u'n03483316', u'hand_blower', 0.025689969), (u'n02910353', u'buckle', 0.015434729), (u'n04542943', u'waffle_iron', 0.012205523)]
Comment puis-je vérifier si elle contient 'car_wheel'? Je essayé:
if 'car_wheel' in results_read:
print('yes')
else:
print('no')
est-il une autre façon de le faire?
copie de http://stackoverflow.com/questions/3437059/does-python-have-a-string-contains-substring-method – yar