4
프로그램에 읽는 파일의 이름이 아래와 같은 문자열을 포함하고 있는지 확인하는 방법을 찾으려고합니다. 그것이 올바른 방법인지 확실하지 않습니다. 당신은 check_word_type()
를 호출하지 않는파일 이름에 문자열이 포함되어 있는지 확인하십시오. 파이썬
def check_word_type(self, filename):
words = ['noun','verb','vrb','adj','adv'] #I am not sure if adj and adv are variables
self.word_type = ''
for i in words:
if i in filename:
self.word_type = str(i) #just make sure its string
return self.word_type