[Tutor] word printing issue
mhysnm1964 at gmail.com
mhysnm1964 at gmail.com
Thu Jun 20 06:44:06 EDT 2019
All,
I have a list of strings that I want to break them into separate words, and
a combination of words then store them into a list. Example below of a
string:
"Hello Python team".
The data structure:
[ ['Hello'],
['Hello', 'Python'],
['Hello', 'Python', 'team'],
]'Python'],
]'Python', 'team'],
['team'] ]
I want to know if there is a better method in doing this without the
requirement of a module. Eventually I want to count the number of hits in a
list of strings based upon the word combinations regardless where they are
located in the string. This last part is something I am struggling with to
get results that are correct. I have stored them in a dictionary and get
unexpected totals. Was thinking of using collection and still working on it.
If the above could be improved. I would be grateful.
Sean
More information about the Tutor
mailing list