Date: 9 Aug 2006 14:12:01 -0700From: "Simon Forman" [EMAIL PROTECTED]Subject: Re: Eval (was Re: Question about using python as a scripting language)To: python-list@python.orgMessage-ID: [EMAIL PROTECTED]Content-Type: text/plain; charset="iso-8859-1"Fredrik Lundh posted a
Slawomir Nowaczyk noted:# Heck, whenever *is* it OK to use eval() then?eval is like optimisation. There are two rules:Rule 1: Do not use it.Rule 2 (for experts only): Do not use it (yet).So, that brings up a question I have. I have some code that goes out to a website, grabs stock data, and sends
Brendon Turns out that the website in question stores its data in the
Brendon format of a Python list
Brendon (http://quotes.nasdaq.com/quote.dll?page=nasdaq100, search the
Brendon source for var table_body). So, the part of my code that
Brendon extracts the data looks
How is your data stored? (site was not loading for me).
test = 'blah = [1,2,3,4,5]'
var,val = test.split('=')
print var,val
blah [1,2,3,4,5]
val = val.strip('[] ')
print val
1,2,3,4,5
vals = [int(x) for x in val.split(',')]
print vals
[1, 2, 3, 4, 5]
More sophisiticated situations (like
skip import re
skip symbolinfo = []
skip sympat = re.compile(
skip r'\[',
Make that
r',?\['
Skip
--
http://mail.python.org/mailman/listinfo/python-list
There were some mistakes in here. Thats what I get for repurposing existing
code for an example. The uncommented lines are changed.
On Wed, Aug 09, 2006 at 11:04:32AM -0400, Chris Lambacher wrote:
from pyparsing import Suppress, Regex, delimitedList, Forward, QuotedString,
Group
stringValue
On 9 Aug 2006, at 11:04 AM, Chris Lambacher wrote:How is your data stored? (site was not loading for me).In the original source HTML, it's like this (I've deleted all but the beginning and the end of the list for clarity):var table_body = [["ATVI", "Activision,
Brendon I could do that, or I could do something like the re.* trick
Brendon mentioned by another poster. But, doesn't it offend anyone else
Brendon that the only clean way to access functionality that's already
Brendon in Python is to write long complicated Python code? Python
On Wed, Aug 09, 2006 at 11:51:19AM -0400, Brendon Towle wrote:
On 9 Aug 2006, at 11:04 AM, Chris Lambacher wrote:
How is your data stored? (site was not loading for me).
In the original source HTML, it's like this (I've deleted all but the
beginning and the end of the list
On 9 Aug 2006, at 12:03 PM, [EMAIL PROTECTED] wrote: Brendon I could do that, or I could do something like the re.* trick Brendon mentioned by another poster. But, doesn't it offend anyone else Brendon that the only clean way to access functionality that's already Brendon in Python is
Chris Lambacher wrote:
On Wed, Aug 09, 2006 at 11:51:19AM -0400, Brendon Towle wrote:
I don't disagree with you. The problem is that the obvious way to do it
(eval) is a big security hole. In this case you are trusting that no one
inserts themselves between you and the website providing you
Chris Lambacher wrote:
On Wed, Aug 09, 2006 at 11:51:19AM -0400, Brendon Towle wrote:
On 9 Aug 2006, at 11:04 AM, Chris Lambacher wrote:
How is your data stored? (site was not loading for me).
In the original source HTML, it's like this (I've deleted all but the
12 matches
Mail list logo