Python script search a text file for a word -
i'm writing python script. need search text file word end " s , es or ies " , word must greater 3 letters , need konw number of words , word it-self .....it's hard task cant work it, please me
i agree comment need go work on basics. here ideas started.
1) "search file." open file , read line line this:
with open ('myfile.txt', 'r') infile: line in infile: # each line
2) want store each line in data structure, list:
# before open file... lines = [] # while handling file: lines.append(line)
3) you'll need work each word. 'split' function of lists.
4) you'll need @ individual letters of each word. 'string slicing.'
all said , done, can 10 - 15 lines of code.
Comments
Post a Comment