Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > issues with htmlparser.getpos

Reply
Thread Tools

issues with htmlparser.getpos

 
 
dysmas
Guest
Posts: n/a
 
      07-04-2007
Hi,


Im having an issue with HTMLParser, the getpos() funtion sometimes
returns things like :

(1, 1247)
(1, 2114)
(1, 216
(1, 222
(1, 2295)
(1, 2382)
(1, 2441)
(1, 2963)
(1, 3040)

i guess this is because the HTMLParser has not correctly parsed the
newline characters in the string fed to it... is there a workaround
for this, without checking the string every time i feed it some data?

 
Reply With Quote
 
 
 
 
Steve Holden
Guest
Posts: n/a
 
      07-04-2007
dysmas wrote:
> Hi,
>
>
> Im having an issue with HTMLParser, the getpos() funtion sometimes
> returns things like :
>
> (1, 1247)
> (1, 2114)
> (1, 216
> (1, 222
> (1, 2295)
> (1, 2382)
> (1, 2441)
> (1, 2963)
> (1, 3040)
>
> i guess this is because the HTMLParser has not correctly parsed the
> newline characters in the string fed to it... is there a workaround
> for this, without checking the string every time i feed it some data?
>

Have you verified that these results aren't correct? There is no
requirements for newlines in HTML, and some computer-generated pages
don't bother to insert them.

regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden
--------------- Asciimercial ------------------
Get on the web: Blog, lens and tag the Internet
Many services currently offer free registration
----------- Thank You for Reading -------------

 
Reply With Quote
 
 
 
 
rokadvertising@googlemail.com
Guest
Posts: n/a
 
      07-04-2007
Steve,

thanks for reply

there are newlines present, it looks like the files in question are
from a mac, (my text editor tells me they are UTF8 & use CR for
marking newlines)

Cheers

 
Reply With Quote
 
rokadvertising@googlemail.com
Guest
Posts: n/a
 
      07-04-2007
On Jul 4, 1:47 pm, (E-Mail Removed) wrote:
> Steve,
>
> thanks for reply
>
> there are newlines present, it looks like the files in question are
> from a mac, (my text editor tells me they are UTF8 & use CR for
> marking newlines)
>
> Cheers


d0h,

f = open(this_file,"U")
^^^^
\ this fixed it

cheers anyway

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Windows XP Pro clean install issues, SP2 issues too... Howie Computer Support 9 07-12-2005 04:47 PM
Windows XP Pro clean install issues, SP2 issues too... Howie Computer Support 0 07-06-2005 07:12 PM
Re: Windows XP Pro clean install issues, SP2 issues too... pcbutts1 Computer Support 0 07-06-2005 04:58 PM
Re: Windows XP Pro clean install issues, SP2 issues too... pcbutts1 Computer Support 0 07-06-2005 04:52 PM
SNMP Issues in Cisco Routers; Vulnerability Issues in TCP =?iso-8859-1?Q?Frisbee=AE?= MCSE 0 04-21-2004 03:00 PM



Advertisments