Replace BeautifulSoup with another (standard) HTML parsing module in this Python script -


I have created a script with beautifully that works fine and is very readable, but I redistribute it for a few days I want to, and beautiful is an external dependency that I would like to save, especially thinking about Windows usage.

Here is the code, it receives each user's link from a given Google Maps user ###### The marked lines are using beautiful soup:

  #coding: UTF-8 import urlb, beautiful soup import from beautiful soup BS UID = '200931058040775970557' start = 0 shown = 1 while true: url = 'http://maps.google.com/maps/user? Uid = '+ uid +' & amp; ptab = 2 & start = '+ str (start) Start source = urlib.urlopen (url) .read () soup = BS (source) #### MapTable = soup.find = Ri Compa Ltd. ( '^ map [0-9] + $ ")) for the table ########## ####### Maptebl: to row in the table. Remove all ('A', 'Meptitol'): ################ mapid = re.search (UID + '. ([^ "] *', Str (line) ) Group (1) mapname = re.search ('> (. *) & Lt; / a & gt;', str (line)) group (1) .strip () [: - 3] print shown Gone, mapped, '\ t', map address shown + = 1 urllib.urlretrieve ('http://maps.google.com.br/maps/ms?msid=' + Uid + '.' + Str (mapid) ) '+ & Amp; msa = 0 and Output = Km L', map name + '.kml') If ' span & gt; Next & lt; / span & gt; Str' : Start + = 5 Others: Break   

As you can see, just three lines using BSUP Yes, but I am not a programmer and I had a lot of possibilities possibly because I tried it incorrectly, I think.

Edit: This question will be passed on to this line of three line codes There is more about changing.

Any help would be appreciated, thanks for reading!

such as third-party modules. BeautifulSuccess . This does not mean that you should have a different dependency - these modules are free software and if you do not want external dependencies, you are welcome to bundle them with your code, and do not do any more to them A dependency compared to the written code.

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

memcached - Django cache performance -