[Tutor] Beautiful Soup

2016-07-26 Thread Crusier
I am using Python 3 on Windows 7. However, I am unable to download some of the data listed in the web site as follows: 453.IMC 98.28M 18.44M 4.325.33 1499.Optiver 70.91M13.29M 3.125.34 7387.花旗环球 52.72M

Re: [Tutor] Beautiful Soup

2016-01-19 Thread Peter Otten
Crusier wrote: > Hi Python Tutors, > > I am currently able to strip down to the string I want. However, I > have problems with the JSON script and I am not sure how to slice it > into a dictionary. > > import urllib > import json > import requests > > from bs4 import BeautifulSoup > > > url =

[Tutor] Beautiful Soup

2016-01-18 Thread Crusier
Hi Python Tutors, I am currently able to strip down to the string I want. However, I have problems with the JSON script and I am not sure how to slice it into a dictionary. import urllib import json import requests from bs4 import BeautifulSoup url = 'https://bochk.etnet.com.hk/content/bochkw

Re: [Tutor] Beautiful Soup

2015-12-13 Thread bruce
Hey Crusier/ (And Others...) For your site... As Alan mentioned, its a mix of html/jscript/etc.. So, you're going (or perhaps should) need to extract just the json/struct that you need, and then go from there. I speak of experience, as I've had to hande a number of sites that are essentially jus

Re: [Tutor] Beautiful Soup

2015-12-13 Thread Alan Gauld
On 13/12/15 07:44, Crusier wrote: > Dear All, > > I am trying to scrap the following website, however, I have > encountered some problems. As you can see, I am not really familiar > with regex and I hope you can give me some pointers to how to solve > this problem. I'm not sure why you mention re

[Tutor] Beautiful Soup

2015-12-12 Thread Crusier
Dear All, I am trying to scrap the following website, however, I have encountered some problems. As you can see, I am not really familiar with regex and I hope you can give me some pointers to how to solve this problem. I hope I can download all the transaction data into the database. However, I

Re: [Tutor] Beautiful Soup

2015-10-12 Thread Cameron Simpson
On 12Oct2015 21:21, Crusier wrote: I am using Python 3.4. I am trying to do some web scraping at this moment. I got stuck because there is an IndexError: list index out of range if I put stock_code = (18). My desire output is that the script is able to detect print out the recent price whether i

[Tutor] Beautiful Soup

2015-10-12 Thread Crusier
Hi I am using Python 3.4. I am trying to do some web scraping at this moment. I got stuck because there is an IndexError: list index out of range if I put stock_code = (18). My desire output is that the script is able to detect print out the recent price whether it is up, down or unchanged. Attac

Re: [Tutor] Beautiful Soup

2015-09-29 Thread Nym City via Tutor
Hello, I have personally found this tutorial to be helpful. Check it out: https://www.youtube.com/watch?v=3xQTJi2tqgk Thank you. On Tuesday, September 29, 2015 12:05 PM, Joel Goldstick wrote: On Tue, Sep 29, 2015 at 11:47 AM, Crusier wrote: > Hi > > I have recently finished rea

Re: [Tutor] Beautiful Soup

2015-09-29 Thread Laura Creighton
>> Hi >> >> I have recently finished reading "Starting out with Python" and I >> really want to do some web scraping. Please kindly advise where I can >> get more information about BeautifulSoup. It seems that Documentation >> is too hard for me. >> >> Furthermore, I have tried to scrap this site b

Re: [Tutor] Beautiful Soup

2015-09-29 Thread Peter Otten
Crusier wrote: > I have recently finished reading "Starting out with Python" and I > really want to do some web scraping. Please kindly advise where I can > get more information about BeautifulSoup. It seems that Documentation > is too hard for me. If you tell us what you don't understand and wh

Re: [Tutor] Beautiful Soup

2015-09-29 Thread Joel Goldstick
On Tue, Sep 29, 2015 at 11:47 AM, Crusier wrote: > Hi > > I have recently finished reading "Starting out with Python" and I > really want to do some web scraping. Please kindly advise where I can > get more information about BeautifulSoup. It seems that Documentation > is too hard for me. > > Fur

[Tutor] Beautiful Soup

2015-09-29 Thread Crusier
Hi I have recently finished reading "Starting out with Python" and I really want to do some web scraping. Please kindly advise where I can get more information about BeautifulSoup. It seems that Documentation is too hard for me. Furthermore, I have tried to scrap this site but it seems that there

[Tutor] Beautiful Soup update

2007-04-16 Thread Kent Johnson
There was a thread here a few months ago about problems with running the unit tests for Beautiful Soup under Python 2.5. These problems have apparently been fixed with a new release of Beautiful Soup. http://www.crummy.com/software/BeautifulSoup/ Kent ___

[Tutor] Beautiful Soup

2006-12-06 Thread Shitiz Bansal
Hi, I am using beautiful soup to get links from an html document. I found that beautiful Soup changes the & in the links to & due to which some of the links become unusable. Is there any way I could stop this behaviour? Regards, Shitiz - Access over 1 million so

Re: [Tutor] Beautiful Soup

2006-11-29 Thread Shitiz Bansal
Thanks, urlparse.urljoin did the trick. Akash- the problem with directly prefixing url to the link is that the url most of the times contains not just the page address but also parameters and fragments. Andreas Kostyrka <[EMAIL PROTECTED]> wrote: * Akash [061129 20:54]: > On 11/30/06, Shitiz Ba

Re: [Tutor] Beautiful Soup

2006-11-29 Thread Andreas Kostyrka
* Akash <[EMAIL PROTECTED]> [061129 20:54]: > On 11/30/06, Shitiz Bansal <[EMAIL PROTECTED]> wrote: > > I am using beautiful soup for extracting links from a web page. > > Most pages use relative links in their pages which is causing a problem. Is > > there any library to extract complete links or

Re: [Tutor] Beautiful Soup

2006-11-29 Thread Akash
On 11/30/06, Shitiz Bansal <[EMAIL PROTECTED]> wrote: > I am using beautiful soup for extracting links from a web page. > Most pages use relative links in their pages which is causing a problem. Is > there any library to extract complete links or do i have to parse this > myself? > Beautiful Soup

[Tutor] Beautiful Soup

2006-11-29 Thread Shitiz Bansal
Hi, I am using beautiful soup for extracting links from a web page. Most pages use relative links in their pages which is causing a problem. Is there any library to extract complete links or do i have to parse this myself? Thanks, Shitiz Terry Carroll <[EMAIL PROTECTED]> wrote: On Wed, 29 Nov

Re: [Tutor] Beautiful Soup, inserting a node?

2005-12-02 Thread Kent Johnson
Bob Tanner wrote: > Kent Johnson wrote: > > >>>Is there a way to insert a node with Beautiful Soup? >> >>BS doesn't really seem to be set up to support this. The Tags in a soup >>are kept in a linked > > > What would the appropriate technology to use? You might also email the author of BS and

Re: [Tutor] Beautiful Soup, inserting a node?

2005-12-02 Thread Kent Johnson
Bob Tanner wrote: > Kent Johnson wrote: > > >>>Is there a way to insert a node with Beautiful Soup? >> >>BS doesn't really seem to be set up to support this. The Tags in a soup >>are kept in a linked > > > What would the appropriate technology to use? Fredrik Lundh's elementtidy uses the Tidy

Re: [Tutor] Beautiful Soup, inserting a node?

2005-12-02 Thread Bob Tanner
Kent Johnson wrote: >> Is there a way to insert a node with Beautiful Soup? > > BS doesn't really seem to be set up to support this. The Tags in a soup > are kept in a linked What would the appropriate technology to use? I tried the xml modules, but they fail on the parsing of the html. -- B

Re: [Tutor] Beautiful Soup, inserting a node?

2005-12-01 Thread Kent Johnson
Bob Tanner wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > Is there a way to insert a node with Beautiful Soup? BS doesn't really seem to be set up to support this. The Tags in a soup are kept in a linked list by their next attribute so you will have to find the right Tag, break t

[Tutor] Beautiful Soup, inserting a node?

2005-11-28 Thread Bob Tanner
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Is there a way to insert a node with Beautiful Soup? I found away to append "things". But Blah Foo! I'd like to insert a tag, like this: Blah Foo! - -- Bob Tanner <[EMA

Re: [Tutor] Beautiful soup

2005-10-05 Thread Oliver Maunder
On 10/4/05, Andrew P <[EMAIL PROTECTED]> wrote: Oops, Paul is probably right.  I thought urllib2 opened local files in the absence of an identifier like "http://".  Bad assumption on my part.  I remembered that behavior from somewhere else, maybe urllib. The following function could be useful here

Re: [Tutor] Beautiful soup

2005-10-04 Thread Oliver Maunder
On 10/4/05, Andrew P <[EMAIL PROTECTED]> wrote: Oops, Paul is probably right.  I thought urllib2 opened local files in the absence of an identifier like "http://".  Bad assumption on my part.  I remembered that behavior from somewhere else, maybe urllib. The following function could be useful here

Re: [Tutor] Beautiful soup

2005-10-04 Thread Andrew P
Oops, Paul is probably right.  I thought urllib2 opened local files in the absence of an identifier like "http://".  Bad assumption on my part.  I remembered that behavior from somewhere else, maybe urllib. That path beginning with "\\C:\\" could still bite you, however.  Good luck, Andrew _

Re: [Tutor] Beautiful soup

2005-10-04 Thread Andrew P
With error messages like that, the interesting bits are usually at the end: OSError: [Errno 2] No such file or directory: '\\C:\\Python24\\FRE_word_list.htm That should read "C:\\Python24\\FRE_word_list.htm".  I use UNIX-style paths, which work fine for me under Windows, so it would just be "/Py

Re: [Tutor] Beautiful soup

2005-10-04 Thread paul brian
How did you change it to look at the file on your PC? You appear to have told urllib2 to use "FRE_word_list.htm", it cannot find that online so tried to look for it on your local disk at '\\C:\\Python24\\FRE_word_list.htm I would suggest that you either put your local html on a web server and send

[Tutor] Beautiful soup

2005-10-04 Thread David Holland
I tried to use this script which I found on the web :- import urllib2, pprint from BeautifulSoup import BeautifulSoup def cellToWord(cell): """Given a table cell, return the word in that cell.""" # Some words are in bold. if cell('b'): return cell.first('b').string.strip()

[Tutor] Beautiful Soup / Unicode problem?

2005-08-26 Thread grouchy
>This is the first question in the BeautifulSoup FAQ at >http://www.crummy.com/software/BeautifulSoup/FAQ.html >Unfortunately the author of BS considers this a problem with your Python installation! So it >seems he doesn't have a good understanding of Python and Unicode. (OK, I can forgive him >th

Re: [Tutor] Beautiful Soup / Unicode problem?

2005-08-26 Thread grouchy
Hi Danny, > If you have a moment, do you mind doing this on your system? > Here you go: >>> import types >>> print types.StringTypes (, ) >>> import sys >>> print sys.version 2.3.4 (#2, May 29 2004, 03:31:27) [GCC 3.3.3 (Debian 20040417)] >>> print type(u'hello' in types.StringTypes True >>>sys

Re: [Tutor] Beautiful Soup / Unicode problem?

2005-08-26 Thread Danny Yoo
> Here you go: > > >>> import types > >>> print types.StringTypes > (, ) > >>> import sys > >>> print sys.version > 2.3.4 (#2, May 29 2004, 03:31:27) > [GCC 3.3.3 (Debian 20040417)] > >>> print type(u'hello' in types.StringTypes > True > >>>sys.getdefaultencoding() > 'ascii' [CCing Leonard Richa

Re: [Tutor] Beautiful Soup / Unicode problem?

2005-08-26 Thread Kent Johnson
grouchy wrote: > Hi, > > I'm having bang-my-head-against-a-wall moments trying to figure all of this > out. > from BeautifulSoup import BeautifulSoup >>> file = urllib.urlopen("http://www.google.com/search?q=beautifulsoup";) file = file.read().decode("utf-8") soup = BeautifulSoup

Re: [Tutor] Beautiful Soup / Unicode problem?

2005-08-25 Thread Danny Yoo
On Thu, 25 Aug 2005, grouchy wrote: > >>>file = urllib.urlopen("http://www.google.com/search?q=beautifulsoup";) > >>>file = file.read().decode("utf-8") > >>>soup = BeautifulSoup(file) > >>>results = soup('p','g') > >>> x = results[1].a.renderContents() > >>> type(x) > > >>> print x > Matt Croy

[Tutor] Beautiful Soup / Unicode problem?

2005-08-25 Thread grouchy
Hi, I'm having bang-my-head-against-a-wall moments trying to figure all of this out. A word of warming, this is the first time I've tried using unicode, or Beautiful Soup, so if I'm being stupid, please forgive me. I'm trying to scrape results from google as a test case. with Beautiful Soup. I'