Working with Python regular Expression

It is used to match a pattern and extract data. For example, capture “Tweedle” in the string “Tweedle Bettle and Kettle”. import re text_from_router = 'vrf definition POLICE' pattern = r'vrf\s+definition\s+(?P<vrf_name>\S+)' match = re.search(pattern,text_from_router) if match: print(match.groupdict()) # prints {'vrf_name': 'POLICE'} \s-->whitespace,\S+-->any character,(?P<name>)-->Create a named capturing group Okay, it is... [Read More]

python array

Staic and dynamic arrays. If we have 8bytes a number, the list [1,2,3] would take up 24 memory space. If its static, the memory would never change. Get would be O(1). So is changing the value of the array. Init and traverse would be O(8N),but we would not need 8... [Read More]