ynonp / python-examples-verint-2016-07

Python examples and exercises
MIT License
2 stars 35 forks source link

ToCode Solution: תרגול ביטויים רגולריים #224

Closed alonshk closed 8 years ago

alonshk commented 8 years ago

if the value of a key has spaces in it as in name = Foo Bar i will get just Foo. What should i do to resolve this ?

szabgab commented 8 years ago

e.g.:

``` re.search(r'(\w+)\s*=\s*(.+)') and then you can remove the trailing spaces from the value, but I might use split with '=' instead of this regex.

BTW This solution will also catch items that were commented out: # name = value that should be avoided.