[Tutor] Praser

Henry henry at sa-hk.com
Sun Oct 23 06:09:06 CEST 2011


Hi Steven,

First of all, I want to able to download the data from the web into
the database. Here is the part of the link:

http://boc.quotepower.com/web/bochk/stocks_mktTransactions.jsp?lang=en&domain=NCBHK&rand=-74344993&lastLevel1Name=nav_stocks&lastStock=5

I hope I can use the download data to do some analysis.

I know it is an impossible task for a newbie; however, I don't mind
doing it step by step. Thank you

Regads,
Crusier



On Fri, Oct 21, 2011 at 1:40 PM,  <tutor-request at python.org> wrote:
> Send Tutor mailing list submissions to
>        tutor at python.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>        http://mail.python.org/mailman/listinfo/tutor
> or, via email, send a message with subject or body 'help' to
>        tutor-request at python.org
>
> You can reach the person managing the list at
>        tutor-owner at python.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of Tutor digest..."
>
>
> Today's Topics:
>
>   1. functions and default argument (Praveen Singh)
>   2. Re: functions and default argument (Christian Witts)
>   3. Web Praser (Crusier)
>   4. Re: functions and default argument (Steven D'Aprano)
>   5. Re: Web Praser (Steven D'Aprano)
>   6. Re: functions and default argument (Prasad, Ramit)
>   7. Re: functions and default argument (Albert-Jan Roskam)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Fri, 21 Oct 2011 09:00:08 -0400
> From: Praveen Singh <c2praveen30jun at gmail.com>
> To: tutor at python.org
> Subject: [Tutor] functions and default argument
> Message-ID:
>        <CAJcoizuP_RaM+BVO7BoTjNQ-D0=T7VmbTMn_XHJGhg9K4T5b_w at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> In function-
>
> "Default value is *evaluated only once*.This makes different when the
> default is a mutable object such as a list, dictionary or instance of most
> classes."
>
> I am not getting it properly-evaluated once?? different behaviour???--
> please explain this.
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mail.python.org/pipermail/tutor/attachments/20111021/aea9410d/attachment-0001.html>
>
> ------------------------------
>
> Message: 2
> Date: Fri, 21 Oct 2011 15:19:39 +0200
> From: Christian Witts <cwitts at compuscan.co.za>
> To: Praveen Singh <c2praveen30jun at gmail.com>
> Cc: tutor at python.org
> Subject: Re: [Tutor] functions and default argument
> Message-ID: <4EA1716B.5060904 at compuscan.co.za>
> Content-Type: text/plain; charset="windows-1252"; Format="flowed"
>
> On 2011/10/21 03:00 PM, Praveen Singh wrote:
>> In function-
>>
>> "Default value is *evaluated only once*.This makes different when the
>> default is a mutable object such as a list, dictionary or instance of
>> most classes."
>>
>> I am not getting it properly-evaluated once?? different behaviour???--
>> please explain this.
>>
>> _______________________________________________
>> Tutor maillist  -  Tutor at python.org
>> To unsubscribe or change subscription options:
>> http://mail.python.org/mailman/listinfo/tutor
>
> Mutable defaults for function/method arguments is a Python Gotcha, you
> can find a good read here [1].  It's a better read than how I would
> explain it.
>
> [1] http://www.ferg.org/projects/python_gotchas.html#contents_item_6
> --
>
> Christian Witts
> Python Developer
>
> //
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mail.python.org/pipermail/tutor/attachments/20111021/2c790f93/attachment-0001.html>
>
> ------------------------------
>
> Message: 3
> Date: Fri, 21 Oct 2011 09:37:40 -0700
> From: Crusier <crusier at gmail.com>
> To: tutor at python.org
> Subject: [Tutor] Web Praser
> Message-ID:
>        <CAC7HCj-A6r32NdEekwiyx0ZZyuOp-w9VGHWwq2Kd6YL5-q9e4w at mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
>
> Hi,
>
> I am new to programming. I want to know what I should look at if I
> want to learn more about Web Praser. I know there is something called
> Beautiful Soup but I think it is kind of difficult for me at this
> stage.
>
> Thank you
>
> Regards,
> Crusier
>
>
> ------------------------------
>
> Message: 4
> Date: Sat, 22 Oct 2011 04:25:51 +1100
> From: Steven D'Aprano <steve at pearwood.info>
> To: tutor at python.org
> Subject: Re: [Tutor] functions and default argument
> Message-ID: <4EA1AB1F.4090204 at pearwood.info>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Praveen Singh wrote:
>> In function-
>>
>> "Default value is *evaluated only once*.This makes different when the
>> default is a mutable object such as a list, dictionary or instance of most
>> classes."
>>
>> I am not getting it properly-evaluated once?? different behaviour???--
>> please explain this.
>
>
> Look at an example:
>
>
>  >>> import time
>  >>> def test(t=time.asctime()):
> ...     print t, "***", time.asctime()
> ...
>  >>> time.sleep(30)  # wait a little bit
>  >>> test()
> Sat Oct 22 04:17:08 2011 *** Sat Oct 22 04:17:57 2011
>  >>> time.sleep(30)  # wait a little bit longer
>  >>> test()
> Sat Oct 22 04:17:08 2011 *** Sat Oct 22 04:18:46 2011
>
>
> Notice that the first time printed, using the default value, is the
> same. The default value for t is assigned once, and not calculated
> again. Since t is a string, it is immutable and can never change.
>
> The same thing occurs when you use a mutable object like a list or a
> dict. The default value is assigned once, and once only. But notice that
> you can modify the default value, say by appending to it:
>
>
>  >>> def test(x=[]):
> ...     print x, id(x)
> ...     x.append(1)
> ...
>  >>> test()
> [] 3085600236L
>  >>> test()
> [1] 3085600236L
>  >>> test()
> [1, 1] 3085600236L
>
>
> It is the same default list every time, but the *contents* of the list
> are changing.
>
>
>
> --
> Steven
>
>
> ------------------------------
>
> Message: 5
> Date: Sat, 22 Oct 2011 04:51:41 +1100
> From: Steven D'Aprano <steve at pearwood.info>
> To: tutor at python.org
> Subject: Re: [Tutor] Web Praser
> Message-ID: <4EA1B12D.5010502 at pearwood.info>
> Content-Type: text/plain; charset=ISO-8859-1; format=flowed
>
> Crusier wrote:
>> Hi,
>>
>> I am new to programming. I want to know what I should look at if I
>> want to learn more about Web Praser. I know there is something called
>> Beautiful Soup but I think it is kind of difficult for me at this
>> stage.
>
> What do you mean by "web parser"? The web (world wide web) is a network
> on the internet, you can't parse it. Do you mean a parser for HTML files?
>
> If you want to learn about parsing, then you should start with something
> simpler than HTML. If you want to learn about HTML, start with a good
> book or tutorial about HTML. There are dozens of them.
>
> Before we can advise you properly, you need to explain what it is you
> actually want to do.
>
>
>
> --
> Steven
>
>
> ------------------------------
>
> Message: 6
> Date: Fri, 21 Oct 2011 15:40:39 -0400
> From: "Prasad, Ramit" <ramit.prasad at jpmorgan.com>
> To: "tutor at python.org" <tutor at python.org>
> Subject: Re: [Tutor] functions and default argument
> Message-ID:
>        <0604E20B5F6F2F4784C9C8C71C5DD4DD2F21AB4441 at EMARC112VS01.exchad.jpmchase.net>
>
> Content-Type: text/plain;       charset="us-ascii"
>
>>The same thing occurs when you use a mutable object like a list or a
>>dict. The default value is assigned once, and once only. But notice that
>>you can modify the default value, say by appending to it:
>
> Not sure this will work exactly the same way in other IDEs, but in mine:
>
>>>> a = []
>>>> def foo(x=a):
> ...     x.append(1)
> ...
>>>> a.append( 2 )
>>>> foo()
>>>> print a
> [2, 1]
>>>> help(foo)
> Help on function foo in module __pieshell__:
>
> foo(x=[2, 1])
>
>>>> foo()
>>>> help(foo)
> Help on function foo in module __pieshell__:
>
> foo(x=[2, 1, 1])
>
>>>> a.append( 3 )
>>>> help(foo)
> Help on function foo in module __pieshell__:
>
> foo(x=[2, 1, 1, 3])
>>>> b = []
>>>> foo(b)
>>>> b
> [1]
>
>
> Notice how it is always bound to the list a, but can be "overridden".
>
> I know this has been discussed on this list or the main list before if you take a look through the archives.
> Sorry I can't remember what the thread would be like or when it was :(
> http://stackoverflow.com/questions/1132941/least-astonishment-in-python-the-mutable-default-argument
>
>
> Ramit
>
>
> Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
> 712 Main Street | Houston, TX 77002
> work phone: 713 - 216 - 5423
>
>
>
>
> This email is confidential and subject to important disclaimers and
> conditions including on offers for the purchase or sale of
> securities, accuracy and completeness of information, viruses,
> confidentiality, legal privilege, and legal entity disclaimers,
> available at http://www.jpmorgan.com/pages/disclosures/email.
>
>
> ------------------------------
>
> Message: 7
> Date: Fri, 21 Oct 2011 13:40:50 -0700 (PDT)
> From: Albert-Jan Roskam <fomcl at yahoo.com>
> To: "Prasad, Ramit" <ramit.prasad at jpmorgan.com>,        "tutor at python.org"
>        <tutor at python.org>
> Subject: Re: [Tutor] functions and default argument
> Message-ID:
>        <1319229650.31516.YahooMailNeo at web110708.mail.gq1.yahoo.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> Interesting thread and webpages. Insightful, but is this really used as a technique in daily practice? It feels a bit like a hack to me. Like the author of one of the websites said: rule #1 don't mess with this.
>
> ?
> Cheers!!
> Albert-Jan
>
>
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?
> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>
>
>>________________________________
>>From: "Prasad, Ramit" <ramit.prasad at jpmorgan.com>
>>To: "tutor at python.org" <tutor at python.org>
>>Sent: Friday, October 21, 2011 9:40 PM
>>Subject: Re: [Tutor] functions and default argument
>>
>>>The same thing occurs when you use a mutable object like a list or a
>>>dict. The default value is assigned once, and once only. But notice that
>>>you can modify the default value, say by appending to it:
>>
>>Not sure this will work exactly the same way in other IDEs, but in mine:
>>
>>>>> a = []
>>>>> def foo(x=a):
>>...? ?  x.append(1)
>>...? ?
>>>>> a.append( 2 )
>>>>> foo()
>>>>> print a
>>[2, 1]
>>>>> help(foo)
>>Help on function foo in module __pieshell__:
>>
>>foo(x=[2, 1])
>>
>>>>> foo()
>>>>> help(foo)
>>Help on function foo in module __pieshell__:
>>
>>foo(x=[2, 1, 1])
>>
>>>>> a.append( 3 )
>>>>> help(foo)
>>Help on function foo in module __pieshell__:
>>
>>foo(x=[2, 1, 1, 3])
>>>>> b = []
>>>>> foo(b)
>>>>> b
>>[1]
>>
>>
>>Notice how it is always bound to the list a, but can be "overridden".
>>
>>I know this has been discussed on this list or the main list before if you take a look through the archives.
>>Sorry I can't remember what the thread would be like or when it was :(
>>http://stackoverflow.com/questions/1132941/least-astonishment-in-python-the-mutable-default-argument
>>
>>
>>Ramit
>>
>>
>>Ramit Prasad | JPMorgan Chase Investment Bank | Currencies Technology
>>712 Main Street | Houston, TX 77002
>>work phone: 713 - 216 - 5423
>>
>>
>>
>>
>>This email is confidential and subject to important disclaimers and
>>conditions including on offers for the purchase or sale of
>>securities, accuracy and completeness of information, viruses,
>>confidentiality, legal privilege, and legal entity disclaimers,
>>available at http://www.jpmorgan.com/pages/disclosures/email.?
>>_______________________________________________
>>Tutor maillist? -? Tutor at python.org
>>To unsubscribe or change subscription options:
>>http://mail.python.org/mailman/listinfo/tutor
>>
>>
>>
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <http://mail.python.org/pipermail/tutor/attachments/20111021/d20cff96/attachment.html>
>
> ------------------------------
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
> End of Tutor Digest, Vol 92, Issue 92
> *************************************
>


More information about the Tutor mailing list