Re.compile regular expression matching a character

Want to use the re regular expression matching such a character:
<input type="hidden" name="LzlNtTBLqO" value="twGXk" />
Use the following matching:
re.compile(r'<input type="hidden" name=.* value=.* \/>')
The correct matching method to the how to write it?
When the match report:
cannot concatenate 'str' and 'tuple' objects

Started by Spike at December 10, 2016 - 6:11 PM

import re


str1 = '<input type="hidden" name="LzlNtTBLqO" value="twGXk" />'

prog=re.compile(r'<input type="hidden" name=.* value=.* \/>')
str2=prog.match(str1)
print str2.group(0)

Posted by Bertram at December 19, 2016 - 6:18 PM

  1. >>> s = '<input type="hidden" name="LzlNtTBLqO" value="twGXk" />'
  2. >>> p = re.compile(r'<input type="hidden" name=.* value=.* \/>')
  3. >>> match = p.match(s)
  4. >>> match
  5. <_sre.SRE_Match object at 0x000000000332BC60>
  6. >>> match.group()
  7. '<input type="hidden" name="LzlNtTBLqO" value="twGXk" />'
Not that your problem. Please put up the problem.

Posted by Julia at December 30, 2016 - 6:30 PM

Have solved, thank you. That is Webpage inside analytical error

Posted by Spike at January 09, 2017 - 7:14 PM

['name:"hPxLsOImnI"', 'value:"vdLlC"']How to put such a list into the dictionary.

Posted by Spike at January 12, 2017 - 7:33 PM

for b in a.split(' '):
k,v = b.split('=')
dict_text[k]=v.strip('"')
The net friend help solve, thank you!

Posted by Spike at January 14, 2017 - 8:14 PM