issues with htmlparser.getpos

D

dysmas

Hi,


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

(1, 1247)
(1, 2114)
(1, 2168)
(1, 2228)
(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?
 
S

Steve Holden

dysmas said:
Hi,


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

(1, 1247)
(1, 2114)
(1, 2168)
(1, 2228)
(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 -------------
 
R

rokadvertising

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
 
R

rokadvertising

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 ;)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top