How to write python function to test the matched strings (to use for Robot framework keyword)?
问题 I am writing a custom library for robot framework in python. I don't want to use builtin library for some reasons. My python code : import os import re output = "IP address is 1.1.1.1" def find_ip(): cmd = 'ipconfig' output = os.popen(cmd).read() match1 = re.findall('.* (1.1.1.1).*',output) mat1 = ['1.1.1.1'] if match1 == mat1: print "PASS" In the above program I have written python function to : Execute a windows command "ipconfig" Written regular expression to match 1.1.1.1 create a list