On Fri, Jul 29, 2011 at 5:58 AM, Karim <karim.liat...@free.fr> wrote:

> **
> On 07/29/2011 11:52 AM, George Anonymous wrote:
>
> I am trying to make a simple programm with Python 3,that tries to open
> differnet pages from a wordlist and prints which are alive.Here is the code:
> from urllib import request
> fob=open('c:/passwords/pass.txt','r')
> x = fob.readlines()
> for i in x:
>     urllib.request.openurl('www.google.gr/' + i)
>
> But it doesent work.Whats the problem?
>
>
> Please give the exception error you get?!
> And you should have in the html header
> the html code error number which gives
> you the fail answer from the server.
>
> Cheers
> Karim
>
> As Karim noted you'll want to mention any exceptions you are getting. I'm
not sure what it is you are trying to do with your code. If you'd like to
try to open each line and try something if it works else an exception the
code may read something similar to:

fob = open('C:/passwords/pass.txt','r')
fob_rlines = fob.readlines()
for line in fob_rlines:
try:
#whatever it is you would like to do with each line
except Exception: #where code didn't work and an exception occured
#whatever you would like to do when a particular *Exception* occurs
Hope that helps,
Alexander

>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription 
> options:http://mail.python.org/mailman/listinfo/tutor
>
>
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to