re.findall printing the full text on a line of tekst
Question: I got the following code:

    
    
    import urllib
    import re
    
    html = urllib.urlopen("http://jshawl.com/python-playground/").read()
    
    lines = [html]
    for line in lines:
        if re.findall("jesseshawl", line):
            print line
    

My output when I run this code, is that it wil return the full website. How
can I only display the row where it did found "jesseshawl". It should return
something like:

    
    
    jesseshawl@gmail.com
    

And is there a way to not return all html tags when I run this?

My output:

    
    
    <html>
    <head></head>
    <body>
    <h1>Some images to download:</h1>
    <img src='python.gif'/><br />
    <img src='terminal.png' />
    <hr />
    
    <h1>Email addresses to extract:</h1>
    jesseshawl@gmail.com<br />
    sudojesse@gmail.com<br />
    
    <hr />
    
    <h1>Login Form:</h1>
    Login here:<br />
    User: user<br />
    Pass: pass
    <form method="POST" action="login.php">
     User: <input type="text" name="username" /><br />
     Pass: <input type="password" name="password" /><br />
     <input type="submit" />
    </form>
    
    <h1>Memorable Quotes</h1>
    <ul>
        <li></li>
    </ul>
    
    </body>
    </html>
    


Answer: You are reading the whole page .S0 it prints all the thing .You have to read
it line by line.There is no need for `findall` you can use `in` operator

**Code:**

    
    
    import urllib
    import re
    
    html = urllib.urlopen("http://jshawl.com/python-playground/").readlines()
    for line in html :
        if "jesseshawl" in line:
            print line
    

**Output:**

    
    
    jesseshawl@gmail.com<br />
    

And if you don't want tags you could remove them using `sub`

**Code2:**

    
    
    import urllib
    import re
    
    html = urllib.urlopen("http://jshawl.com/python-playground/").readlines()
    for line in html :
        if "jesseshawl" in line:
            print re.sub("<[^>]*?>","",line)
    

**Output2:**

    
    
    jesseshawl@gmail.com
    

