Hi here's my code:
keywords_list = """
cow
dog
cat
"""
keywords_list = [i.strip() for i in keywords_list.split("\n") if i]
I'm still getting an empty element(last element) and I'm wondering why. Also suggestions to improve my code would be appreciated.
Thanks in advance!
edit: solved it myself by stripping the string first but I'm still wondering why there's a remaining empty string element in the list.
Here's my solution:
keywords_list = [i.strip() for i in keywords_list.strip().split("\n")]