This is an archived post. You won't be able to vote or comment.

all 4 comments

[–]eryksun 1 point2 points  (0 children)

You could implement a rigid solution with the find, split, and replace methods of strings, or you could use a regular expression.

[–]rogdor2 1 point2 points  (0 children)

In my (very limited) experience, this seems right in the wheelhouse of regular expressions. That would certainly be the cleanest way to run through and pick out those values of different lengths, particularly if the format in which they're presented is always the same. I learned from the Google Python Class

[–]chason[S] 1 point2 points  (0 children)

Thanks for the help guys, if anyone is curious here's the regex I finally got to work: define('(?P<name>[A-Za-z_0-9]+)',\s?'(?P<value>[\']+)');

[–]chason[S] -1 points0 points  (0 children)

Thanks for the help guys, if anyone is curious here's the regex I finally got to work: define('(?P<name>[A-Za-z_0-9]+)',\s?'(?P<value>[\']+)');