On Sep 28, 8:30 pm, xkenneth [EMAIL PROTECTED] wrote:
Looking to do something similair. I'm working with alot of timestamps
and if they're within a couple seconds I need them to be indexed and
removed from a list.
Is there any possible way to index with a custom cmp() function?
I assume it
On Jul 22, 7:56 am, Gilles Ganault [EMAIL PROTECTED] wrote:
On Sat, 21 Jul 2007 22:18:56 -0400, Carsten Haese
[EMAIL PROTECTED] wrote:
That's your problem right there. RE is not the right tool for that job.
Use an actual HTML parser such as BeautifulSoup
Thanks a lot for the tip. I tried
On Jun 16, 5:27 am, Steven D'Aprano
[EMAIL PROTECTED] wrote:
Currently, *t and **d are syntax errors outside of function calls and
definitions. (Any other places?) But if they were allowed, what would they
mean?
Actually since you asked, I had to try this out
x = range(10)
a, *b = x
I would
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 want to put
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 does
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):
if name ==
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. This also
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
by
[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 problem
[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):
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!
bahoo
listOfLists =
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 stray ([^0-9])
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 which maps an
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]) s.remove(0024)
s
set([haha])
On Apr 2, 5:29 pm, Bjoern Schliessmann usenet-
[EMAIL PROTECTED] 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()
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:
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 portions of
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 anymore (where
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 variables, I get
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:
img src=src alt=text
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 feed
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 to help. What
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 for format string
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((.*)img (.*?) src=\(.*?)img(.*?)\(.*?),
re.S)
That pattern is just really slow to evaluate. What you want is
probably something more like
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).
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 and
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
Look into
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
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/python-list
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 foo
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
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
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 happening too
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'
...
Test.greet = greet
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 is that globals() dictionary is somewhat
different
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
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 that
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__ == __main__:
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. NOT LIKE
40 matches
Mail list logo