By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,548 Members | 1,550 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,548 IT Pros & Developers. It's quick & easy.

Mechanize-Browser question..

P: n/a

i have the following piece of test code. i'm trying to implement/check out
the follow-link method. i'm just trying to figure out how to get a link from
the page.

i was hoping that the regex would basically get the 1st url link...

any thoughts/comments/ideas as to what i'm doing wrong.



br = Browser()
# Log HTTP response bodies (ie. the HTML, most of the time).
# Print HTTP headers.
r2 = br.follow_link(url_regex=re.compile(r"\*"),nr=1) <<<<<<<<<<<<<<<

response = br.response() # this is a copy of response

Jul 8 '06 #1
Share this Question
Share on Google+
1 Reply

P: n/a

bruce wrote:
r2 = br.follow_link(url_regex=re.compile(r"\*"),nr=1) <<<<<<<<<<<<<<<
Seems to me your regex is buggy. You are using a "raw string" yet you
still escape the asterisk ('*') with a backslash? This will only match
a string which contains an asterisk, while I'm guessing you're tring to
match all strings.

Try removing the backslash.
P.S. In future postings, be more verbose: What are you trying to do?
What is the unexpected behavior that you are seeing? etc.

- Tal

Jul 9 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.