So, lets say I want to find the entries that end in foo
.
You'd think you do something like:
results = list.endswith("foo")
And then print out the entries that end in the string foo
How would I do this?
The following works, but let's call the list myList:
result = [x for x in myList if x.endswith('foo')]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With