+ 1
How to convert the text in text file into a list to append it...ect
Hey, I'm trying to make a program that can search for stuff which is located in a text file, I thought of turning the text into a list(s) so I can define a function to search for keywords in that list. ( if there's a better way to make such code let me know, I'm still a beginner in python )
2 ответов
+ 4
if your text is imported as a string called text, you can use:
mylist = text.split()
mylist is then a list of all the space separated words from the text.
If you try something, post your code here to make it easier to help you :-)
+ 1
Alright, thanks! I'll share my code here when I finish it. Thanks once again.