The below is a code sample without using list comprehension or lambda function just a straight forward to enumerate through items in a list of dictionary to try to find a match in name. To test the above, print(search('John')) result is : John another test, print(search('cyrus')) result is : cyrus is not found.. Lambda function … Continue reading [python]list comprehension and lambda function
Tag: list comprehension
[python]Regular expression
I have been avoiding regex for years as I find it very intimidating, however it seems this is a necessary skill to learn to build real things, I have real use cases to match for routes, access-lists and interfaces of routers and firewalls. Here is a code snippet for the regex block, in this code … Continue reading [python]Regular expression
[python]List comprehension and map method
I want this output in string: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15', '16', '17', '18', '19', '20'] Method one: List comprehension: Method two: Map method. map(function, iterable)