for line3 in myips matching too longer matches.

Chris Roberts thecjguy1 at gmail.com
Wed Jun 26 17:21:50 EDT 2019


###
CODE:
           elif line1.rstrip(‘\n’) in line2.strip(‘\n’):
               for line3 in myips:
                   print “###”
                   print “line1 is %s” % line1.rstrip(‘\n’)
                   print “line2 is %s” % line2.strip(‘\n’)
###
OUTPUT:
line1 is 10.10.168.2
line2 is              - address: 10.10.168.27  # myhost
###

I think the problem is here: 
line1.rstrip(‘\n’) in line2.strip(‘\n’):  

I want it to
match only 10.10.168.2 AND 10.10.168.2:
NOT match 10.10.168.2[0-9]

If someone out there knows a simple solution. I would love to see it.
Thanks in advance. 
crzzy1




More information about the Python-list mailing list