Re: Struggling with this concept please help

2005-09-26 Thread Diez B. Roggisch
George wrote:
 Not allowed to use Beautiful Soup because of the very important built
 ins that is provides that makes it very simple to complete this
 problem. Not my choice . This is a review question for our final in two
 months and I just want to get things going so I can try to understand
 things better. Please help.

Post your code. Nobody is giving you the solution to your problem - it's 
your task, after all! But we'd happily comment on your trials.

Diez
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Struggling with this concept please help

2005-09-26 Thread John Hazen
* George [EMAIL PROTECTED] [2005-09-25 16:20]:
 Hello everyone I know many have helped but I cannot get this to work
 out correctly.
snip
 Please help I have never done python before and I can't seem to get the
 hang of it.

You posted code.  Is what's in the docstring actual output?  If so, what
isn't it doing that you want it to?

If it's not working correctly, what's it doing?  Just saying I cannot
get this to work doesn't give us much to go on.  If you want specific
help, be sure to:

1) post actual code
2) explain what you expect it to do
3) post actual output (or traceback)
4) ask a specific question about what you don't understand about item 3.

Even though we know this is schoolwork, I'm OK with offering you a hint
or answering a specific question.

-John
-- 
http://mail.python.org/mailman/listinfo/python-list


Struggling with this concept please help

2005-09-25 Thread George
Hello everyone I know many have helped but I cannot get this to work
out correctly. I cannot use BeautifulSoup at all. I need to:
  Parse the HTML and extracting all the links, convert them to IP
addresses, and build a list of all these IP addresses, thwn I need to
sort the list and remove the duplicates so that unit testing will work.
Please help I have never done python before and I can't seem to get the
hang of it.


Module to print IP addresses of tags in web file containing HTML

 showIPnums('http://22c118.cs.uiowa.edu/uploads/easy.html')
['0.0.0.0', '128.255.44.134', '128.255.45.54']


 showIPnums('http://22c118.cs.uiowa.edu/uploads/pytorg.html')
['0.0.0.0', '128.255.135.49', '128.255.244.57', '128.255.30.11',
'128.255.34.132', '128.255.44.51', '128.255.45.53',
'128.255.45.54', '129.255.241.42', '64.202.167.129']



import htmllib
import formatter
import urllib
import socket

from urlparse import urlparse

class HTML_Parser(htmllib.HTMLParser):
def __init__(self):
htmllib.HTMLParser.__init__(self,
formatter.AbstractFormatter(formatter.NullWriter()))


def start_a(self, args):
for key, value in args:
if key.lower() == 'href':
global listURL

def showIPnums(URL):
 parser = HTML_Parser()
 connect = urllib.urlopen(URL)
 data =  connect.read()
 parser.feed(data)
 parser.close()
 connect.close()

if __name__ == '__main__':
 import doctest, sys 
 doctest.testmod(sys.modules[__name__])

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Struggling with this concept please help

2005-09-25 Thread George Sakkis
George [EMAIL PROTECTED] wrote:

 Hello everyone I know many have helped but I cannot get this to work
 out correctly. I cannot use BeautifulSoup at all. I need to:
 [snipped]

What do you mean you cannot use BeautifulSoup ? You cannot download it, install 
it, import it, or
you are not allowed to use it because it's a homework ? If it's the latter, I 
doubt that you'll get
a solution spelled out for you in this group.

George


-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Struggling with this concept please help

2005-09-25 Thread George
Not allowed to use Beautiful Soup because of the very important built
ins that is provides that makes it very simple to complete this
problem. Not my choice . This is a review question for our final in two
months and I just want to get things going so I can try to understand
things better. Please help.

-- 
http://mail.python.org/mailman/listinfo/python-list