Qns on blank lines

E

eight02645999

hi

i have some regular exp code in perl that i want to convert to python.


if $line =~ m#<(tag1)>(.*)</\1>#
{
$variable = $2;
}

the perl code finds a line that matches something like

"<tag1>sometext<\tag1>" in the line and then assign $variable the value
of "sometext"

how can i do an equivalent of that using re module?
thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top