Python: exploring the use of startswith against a list: tuple, regex, list comprehension, lambda
As with any programming language, Python has a multitude of ways to accomplish the same task. In this article, I will explore the idea of taking a string and checking if it ‘startswith’ any of the strings from a predetermined list. As context for the example code, RFC1918 sets out several IPv4 ranges that can … Python: exploring the use of startswith against a list: tuple, regex, list comprehension, lambda