Python: Counting words from a given file starting with 'L'
Question: I am new to python.I want to know how to count the number of words **starting
with a particular letter say 'L'** from a text file.


Answer: [str.startswith(prefix[, start[,
end]])](https://docs.python.org/2/library/stdtypes.html)

Give this a shot but import your file there are also a few other ways.

    
    
    list = ["apple", "bannana", "custard", "shoe", "ant", "police", "python"]
    newList = []
    
    for word in list:
        if word.startswith('a'):
            newList.append(word)
    
    print newList
    ['apple', 'ant']
    

