虽然我也是初学者,但我解释一下这个问题。 if name.find('Swa')==0的意思是,如果‘Swa’在name里,返回Swa在name中的索引值,这个索引值等于0的话,打印Yes,It does not contain strings "Swa" 如果按你的意思应该这么编: name = 'Swaroop' if 'Swa' not in name: print('Yes,It does not contain strings "Swa"') else: print('Yes,It contain strings "Swa"')