jd wrote:
> I'd like to create a program that takes files with "jsp-like" markup
> and processes the embedded code (which would be python) to produce the
> output file. There would be two kinds of sections in the markup file:
> python code to be evaluated, and python code that returns a value tha
On Mar 23, 9:30 am, Mark <[EMAIL PROTECTED]> wrote:
> A small script called "python_compile_and_run" in "pseudo" code:
>
> #!/usr/bin/env python
> import sys
>
> # Following is invalid syntax unfortunately :(
> from sys.argv[1].rstrip('.py') import main
>
> sys.argv = sys.argv[1:]
> if __name__ ==
On Mar 24, 5:20 pm, [EMAIL PROTECTED] wrote:
> > File "Python-episode12-Zahlenraten.py", line 15
> > print "Die eingegebene Zahl ist kleiner als die generierte Zahl."
>
> IndentationError: expected an indented block
You should indent stuff inside if-statement deeper than the if itself.
I.e.
On Mar 25, 2:46 am, Mark <[EMAIL PROTECTED]> wrote:
> On Sat, 24 Mar 2007 07:21:21 -0700, irstas wrote:
> > A simple implementation that "works":
>
> Not quite irstas BTW ..
I was expecting this, hence the quotes around 'works' :P.
Another known issue
On Mar 25, 9:13 am, "7stud" <[EMAIL PROTECTED]> wrote:
> MyClass.someFunc
>
> Is there some other way to retrieve a user-defined function object
> from a class other than using the class name or an instance?
What Steven B. already said, MyClass.__dict__['someFunc'], is a
different way than MyClass
On Mar 26, 3:16 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> But to make that work reliably, it has to be ensured that no sideeffects
> occur while being in some_long_running_stuff. which doesn't only extend to
> python itself, but also external modules and systems (file writing, network
> c
On Mar 26, 4:47 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> > You can get the speed of fortran in Python by using libraries like
> > Numeric without losing the readability of Python.
>
> Can you back this up with some source??
> Chris
If you execute one command in Python which tells a sup
On Mar 26, 4:41 pm, durumdara <[EMAIL PROTECTED]> wrote:
> Hi!
>
> I want to check my zip file writings.
> I need some callback procedure to show a progress bar.
> Can I do that?
> I don't want to modify the PyLib module to extend it, because if I get
> another py, the changes are lost.
> This happ
On Mar 26, 7:15 pm, "7stud" <[EMAIL PROTECTED]> wrote:
> On Mar 25, 3:09 pm, Steven Bethard <[EMAIL PROTECTED]> wrote:
>
> > Here's another way of looking at it::
>
> > >>> class Test(object):
> > ... pass
> > ...
> > >>> def greet():
> > ... print 'Hello'
> >
On Mar 27, 11:39 am, "alain" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> Could someone tell me how to uninstall SPE under windows?
>
> Alain
Dunno about SPE, but most Python modules I've installed can
be uninstalled from control panel/add remove programs.
--
http://mail.python.org/mailman/listinfo/pyth
On Mar 27, 9:15 pm, [EMAIL PROTECTED] wrote:
> Technically speaking, you can catch all errors as follows:
>
> try:
># do something
> except Exception, e:
>print e
That won't catch exceptions/errors that don't derive from
Exception class. For example a string won't be caught:
try:
raise
On Mar 29, 10:49 pm, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> Thanks. Can you please tell me how can I do a Post form submission
> using the urlLib2 library? I look at your link, but i cant find an
> example there.
>
> Thank you.
http://www.python.org/doc/current/lib/module-urllib2.html
L
On Mar 29, 9:19 pm, [EMAIL PROTECTED] wrote:
> I am looking for a fake consumer review generator that could generate
> realistic looking reviews for any products, kind of like on amazon.com but
> generated by Artificial Intelligence. Is there a package available in your
> favorite programing lan
On Apr 1, 6:12 am, "[EMAIL PROTECTED]"
<[EMAIL PROTECTED]> wrote:
> But when 'data' does not contain pattern, it just hangs at
> 're.findall'
>
> pattern = re.compile("(.*) re.S)
That pattern is just really slow to evaluate. What you want is
probably something more like this:
re.compile(r']*src\s
On Apr 1, 3:13 pm, "Ulysse" <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I'm trying to extract the data from HTML table. Here is the part of
> the HTML source :
>
>
>
> Do you know the way to do it ?
Beautiful Soup is an easy way to parse HTML (that may be broken).
http://www.crummy.com/software/B
On Apr 1, 6:59 pm, Duncan Smith <[EMAIL PROTECTED]> wrote:
> Hello,
> I am currently implementing (mainly in Python) 'models' that come
> to me as Excel spreadsheets, with little additional information. I am
> expected to use these models in a web application. Some contain many
> worksheets
On Apr 2, 5:29 pm, Bjoern Schliessmann wrote:
> Laurent Pointal wrote:
> > And so the solution to add "global foo" before using it.
>
> Didn't you read his final question?
>
> | All of a sudden, tiny() can see the global variable "foo". Very
> | confusing! Why is it that tiny() sometimes can, an
On Apr 2, 4:20 pm, Ernesto García García
<[EMAIL PROTECTED]> wrote:
> Hi experts,
>
> How would you do this without the more and more indenting cascade of ifs?:
>
> match = my_regex.search(line)
> if match:
> doSomething(line)
> else:
> match = my_regex2.search(line)
> if match:
> doS
On Apr 2, 4:05 pm, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote:
> > If the OP is constrained to standard libraries, then it may be a
> > question of defining what should be done more clearly. The extraneous
> > spaces can be removed by tokenizing the string and rejoining the
> > tokens. Replacing
On Apr 2, 7:22 pm, Florian Lindner <[EMAIL PROTECTED]> wrote:
> Hello,
> I'm looking for python RSS feed parser library.
> Feedparserhttp://feedparser.org/does not seem to maintained anymore.
>
> What alternatives are recommendable?
>
> Thanks,
>
> Florian
Well, even if it's not maintained anymor
On Apr 2, 10:09 pm, "erikcw" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm parsing xml data with xml.sax and I need to perform some
> arithmetic on some of the xml attributes. The problem is they are all
> being "extracted" as unicode strings, so whenever I try to perform
> math operations on the varia
On Apr 2, 10:08 pm, Michael Hoffman <[EMAIL PROTECTED]> wrote:
> [EMAIL PROTECTED] wrote:
> > But it could be that he just wants all HTML tags to disappear, like in
> > his example. A code like this might be sufficient then: re.sub(r'<[^>]
> > +>', '', s).
>
> Won't work for, say, this:
>
>
> --
>
On Apr 2, 10:20 pm, Florian Lindner <[EMAIL PROTECTED]> wrote:
> Some of the question I have but found answered nowhere:
>
> I have a feedparser object that was created from a string. How can I trigger
> a update (from a new string) but the feedparser should treat the new string
> like the same fee
On Apr 2, 10:50 pm, "erikcw" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I'm trying to format a string like so:
>
> string = "You have a 75% chance of success with %s, don't use %s" %(a,
> b)
>
> This gives me:
> TypeError: not enough arguments for format string
>
> I've tried 75\%, but that doesn't seem
On Apr 2, 10:52 pm, [EMAIL PROTECTED] wrote:
> On Apr 2, 10:50 pm, "erikcw" <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I'm trying to format a string like so:
>
> > string = "You have a 75% chance of success with %s, don't use %s" %(a,
> > b)
>
> > This gives me:
> > TypeError: not enough arguments
[EMAIL PROTECTED] wrote:
> Hi,
>
> I have just started learning python.I need to parse an XML file
> and present the contents in a particular format.The format is called
> as "ini" file.I have written some code.A section of the format needs
> the data to be present in format as given below:
>
On Apr 3, 5:42 pm, "TG" <[EMAIL PROTECTED]> wrote:
> Hi there.
>
> Reading the page on python performance (http://scipy.org/PerformancePython
> ) made me realize that I can achieve tremendous code acceleration with
> numpy just by using "u[:,:]" kind of syntax the clever way.
>
> Here is a little p
[EMAIL PROTECTED] wrote:
> Hi! Im new to Python and doing exercise found from internet. It is
> supposed to evaluate expression given with postfix operator using
> Stack() class.
>
> class Stack:
> def __init__(self):
> self.items = []
>
> def push(self, item):
> self.i
On Apr 3, 7:12 pm, "bahoo" <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I want to have many lists, such as list0, list1, list2, ..., each one
> holding different number of items.
> Is there something like
> list[0]
> list[1]
> list[2]
>
> so that I can iterate through this list of lists?
>
> Thanks!
> baho
On Apr 3, 7:14 pm, "Richard Brodie" <[EMAIL PROTECTED]> wrote:
> <[EMAIL PROTECTED]> wrote in message
> >There may be something wrong with the "re" code in your example,
> >but I don't know enough about that to help in that area.
>
> There is a stray leading space in it.
Nah, I'd say there's a str
On Apr 3, 7:26 pm, "abcd" <[EMAIL PROTECTED]> wrote:
> Hi,
> I have a class such as,
>
> class Type:
> def __init__(self, val):
> self.val = val
>
> class Person:
> def __init__(self, name, age):
> self.name = name
> self.age = age
>
> So I have a dictionary whic
On Apr 3, 10:13 pm, "bahoo" <[EMAIL PROTECTED]> wrote:
> On Apr 3, 2:31 pm, "Matimus" <[EMAIL PROTECTED]> wrote:
>
> > It depends on your application, but a 'set' might really be what you
> > want, as opposed to a list.
>
> > >>> s = set(["0024","haha","0024"])
> > >>> s
>
> > set(["0024","haha"])>
Carl Banks wrote:
> On Apr 4, 2:08 pm, John Nagle <[EMAIL PROTECTED]> wrote:
> > The syntax that browsers understand as HTML comments is much less
> > restrictive than what BeautifulSoup understands. I keep running into
> > sites with formally incorrect HTML comments which are parsed happily
On Apr 7, 6:48 am, James Stroud <[EMAIL PROTECTED]> wrote:
> Neal Becker wrote:
> > One thing I sometimes miss, which is common in some other languages (c++),
> > is idea of block scope. It would be useful to have variables that did not
> > outlive their block, primarily to avoid name clashes. Th
On May 23, 10:07 pm, Mangabasi <[EMAIL PROTECTED]> wrote:
> This is the winner:
>
> class Point(list):
> def __init__(self, x, y, z = 1):
> super(Point, self).__init__([x, y, z])
> self.x = x
> self.y = y
> self.z = z
>
> def __getattr__(self, name):
>
On May 31, 12:31 am, "Warren Stringer" <[EMAIL PROTECTED]> wrote:
> This is inconsistent:
>
> why does c[:][0]() work but c[:]() does not?
> Why does c[0]() has exactly the same results as c[:][0]() ?
> Moreover, c[:][0]() implies that a slice was invoked
It's not inconsistent, but [:] probably do
On May 31, 5:59 pm, "Warren Stringer" <[EMAIL PROTECTED]> wrote:
> Still I prefer
>
> funcs[:]()
>
> Because, I can describe it in English as "call everything that funcs has"
Wouldn't funcs() be even better? It's shorter, and it seems like
that's the only thing you're striving for. Why do you wan
37 matches
Mail list logo