4 ms·
You can also pass in the method from the str type: key=str.lower It will be faster, but it will break on elements that aren't strings (which could be good
by maxerickson 13y ago
You can also pass in the method from the str type:
key=str.lower
It will be faster, but it will break on elements that aren't strings (which could be good or bad).
- koenigdavidmj 13y agoThen you can use key=operator.methodcaller("lower") and handle any type.