regex - Why does Python add extra quotes in my array returned by split()? -
The relevant data is parsed here:
Optional classname: 'FutureServ', optional Classname: ['HardwareHarvi'], Alternative ClassName: ['OptimusServe', 'OptimusSwive Two'] Here's my Reggae:
alternate_regex = re .compile ('. * AlternateClassName \ s *: \ * (\ [* * * * * * * *.]] [\ * \ "] \ * S (*) \ * s [\. ? '\']). * ', Re.m) And here is my code:
alternate_match = alternate_regex.match (line) if Alternate_match and alternate_match group Alternate_mackgrup (1): Alternatelist = Alternate_mackgrup (1) Kstrip (). The printed (',') print is alternateList dependent _mapping [classpathTxt] ['alternateList'] = Optional list printed here:
[" I was hoping that this would be: 'futurus'' '[] ["hardware service"] ["[' optism savour ',' 'optimusvers'' ']]
['FutureSwarvi'] ['Hardware servi'] ['Optimism Servi', 'Optimus All Two'] Anyone know that What is happening?
You are not doing anything because there is no parameter in it. Instead, call it .strip ("'") >> gt; & Gt; X = "Hello" "& gt; & Gt; & Gt; X.strip () "Hello" "& gt; & Gt; & Gt; X.strip ("'")' Hello '& gt; & Gt; & Gt;
Comments
Post a Comment