[EMAIL PROTECTED] wrote:
another approach (probably frowned upon, but it has worked for me) is
to use python syntax (a dictionary, say, or a list) and just import (or
reload) the file
this sounds good.
can I import a whole collection of instances this way?
-
(thanks for all the other
the sys.path.append has done the work.
thanks.
.
--
http://lazaridis.com
--
http://mail.python.org/mailman/listinfo/python-list
x.__class__.__dict__[mname](x,*args,**kwargs)
here
x is an instance of a class FOO
FOO has a method bar (if the value of mname is bar)
args is a tuple whose length is the number of positional arguments
accepted by bar
kwargs is a dictionary corresponding to the keyword arguments accepted
by bar.
Is it possible to have method names of a class generated somehow
dynamically?
More precisely, at the time of writing a program that contains a class
definition I don't know what the names of its callable methods should
be. I have entries stored in a database that are changing from time
Fixed...
All I did was change #!/usr/bin/python to #!/usr/local/bin/python
The page loaded right up it was loading Python ver 2.4.1 rather
than 2.4.2 where the MySQL db module was installed...
I knew it would be something easy... I learned something so it was
worth it...
--
Roel Schroeven wrote:
Steve Holden schreef:
How does
http://beta.python.org/about/beginners/
look?
I think it's OK, apart from the fact that the font size of the text
overrides my browser's default. It looks and reads much better without
the font-size: 75%.
I'll second this.
Daniel Nogradi wrote:
Thanks for all the replies, it became clear that I need to look into
getattr, __getattr__ and __call__. I'll do that, but since you asked,
here is the thing I would like to do in a little more detail:
My database has 1 table with 2 fields, one called 'name' and the
Giovanni Bajo wrote:
James Stroud wrote:
I'm using pyinstaller 1.0 (stable) on win32xp and it is not able to
find the codec for several encodings (hex, base64, etc.). I resorted
to writing my own for hex, just to see if I could get my program
deployed. But I think a more permanent solution
On Thu, 26 Jan 2006 20:35:26 +, Danny wrote:
Hello again,
I am now trying to make something to change some encrypted text into
some plain text, here is the code I have so far:
text = '@[EMAIL PROTECTED]@[EMAIL PROTECTED]' // some text
num = '213654' // Number
s1 = '700'
s2 = '770'
My database has 1 table with 2 fields, one called 'name' and the other
one called 'age', let's suppose it has the following content, but this
content keeps changing:
Alice 25
Bob 24
--- program1.py
class klass:
# do the stuff with getattr
On Thu, 26 Jan 2006 15:40:47 -0800, Murali wrote:
In Python, dictionaries can have any hashable value as a string.
No. Dictionaries can have any hashable value as a KEY. They are not
automatically converted to strings.
In particular I can say
d = {}
d[(1,2)] = Right
d[(1,2)] = Wrong
From the syntax, this appears to be the odbc module included
with the Pywin32 package.
http://sourceforge.net/projects/pywin32/
You probably have it installed with the 2.1.1 version, but
not 2.4.
hth
Roger
[EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED]
I would like to
Daniel Nogradi wrote:
...
- database content ---
Alice 25
Bob 24
- program1.py -
class klass:
...
inst = klass()
- program2.py ---
import program1
# The code in klass above should be such that the following
# line should
Here you go:
database = {
... Alice: 24,
... Bob:25}
...
class Lookup(object):
... def __catcher(self, name):
... try:
... print Hello my name is %s and I'm %s % (name,
database[name])
... except KeyError:
...
newer success stories please...
mt
--
http://mail.python.org/mailman/listinfo/python-list
Murali [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
In Python, dictionaries can have any hashable value as a string. In
particular I can say
d = {}
d[(1,2)] = Right
d[(1,2)] = Wrong
d[key] = test
In order to print test using % substitution I can say
print %(key)s % d
Is
Murali [EMAIL PROTECTED] writes:
Pulling out pages from existing PDF files can be done with Open Source
stuff. The simplest would be pdftk (PDF Toolkit). The most fancy will
be using latex and the pdfpages package together with pdflatex.
- Murali
There's also pyPDF, at
I like the design, though I'd prefer stronger colors. I think it would
be a major improvement except for the logo.
I agree with others that the logo is a serious disappointment. Although
the symmetry has some initial appeal, I do not see or want to see a
two-ness about Python, and I find it
Hello,
Can someone tell me what I am doing wrong in this code.
If I create a file change.py with the following contents:
def intTest(M, c):
r = M
for k in c:
print 'int(r/k) = ', int(r/k), 'r =', r, 'k =', k, 'r/k
=', r/k
r = r - (k*int(r/k))
On 26 Jan 2006 18:42:34 -0800,
Brian [EMAIL PROTECTED] wrote:
If I execute a similar command from the command line, it works just
fine:
int(0.05/0.05)
1
Try this:
print 2.3 - int(2.3/.25)*.25
0.05
2.3 - int(2.3/.25)*.25
0.049822
Then check out
Christoph Conrad [EMAIL PROTECTED] wrote:
Hallo Alex,
r = re.compile([^a]*a{3}b+(a+b*)*) matches = [s for s in
listOfStringsToTest if r.match(s)]
Unfortunately, the OP's spec is even more complex than this, if we are
to take to the letter what you just quoted; e.g. aazaaab SHOULD
Steve Holden wrote:
How does
http://beta.python.org/about/beginners/
look?
Steve,
This is a great writeup. Here are my comments:
1. Fortunately Python is something that an experienced programmer of
another language (be it ...
Add C# and/or Java to this list. The current list
Daniel Nogradi wrote:
Well, I would normally do what you suggest, using parameters, but in
the example at hand I have to have the method names as variables and
the reason is that the whole thing will be run by apache using
mod_python and the publisher handler. There a URL
Thanks for this but I'm still getting an empty character (I don't
know what else to call it) rather than the text captured by my regular
expression in my replaced text.
I even added the utf encoding declaration to my input data but still no
luck.
Any suggestions?
--
Thanks for the reply Peter. Can you provide a code snippet for
extracting this data. When I print the dir() of the SimpleXMLRPCServer
instance I do not see a request_handler attribute or method.
Phil
--
http://mail.python.org/mailman/listinfo/python-list
On Jan 26, 2006, at 6:37 PM, Ilias Lazaridis wrote:
As a first step, a free personal edition (non-commercial and academic
use) would help to spread the Komodo IDE within the communities.
This would be a gentle contribution to the open source dynamic
languages, which are a foundation for the
I just published my first article on ONLamp, a beginner's walkthrough for
pyparsing.
Please check it out at
http://www.onlamp.com/pub/a/python/2006/01/26/pyparsing.html, and be sure to
post any questions or comments.
-- Paul
--
http://mail.python.org/mailman/listinfo/python-list
Thanks !
well..acutally this is siddharth dave i am a BIG al pacino fan ..(and
before joning this grp i had just watched 'scent of a woman) hence
this pun on myself!!
neways thanks for replying
ps: dear edwards watch 'scent of a woman' and u will forget 'doniie
brosco'..:-) AL pacino won an
There doesn't seem to be any way to customize the behavior of is as
can be done for other operators... why not?
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
Something like this:
progname = 'c:\tmp\myprog.exe arg1 '+'-- help'
os.system(r'progname)
should work too.
So you should be able to change progname to any location you need to
start it and all the args to whatever is needed.
--
http://mail.python.org/mailman/listinfo/python-list
Greeting,
HTMLTestRunner is an extension to the Python standard library's unittest
module. It generates easy to use HTML test reports. See a sample report at
http://tungwaiyip.info/software/sample_test_report.html.
Check more information and download from
Lonnie Princehouse wrote:
There doesn't seem to be any way to customize the behavior of is as
can be done for other operators... why not?
because it does id(a) == id(b), and there's no way to customize
the behaviour of id().
(objects are not allowed to lie about who they are, or what they
Thanks Guys!
I've written several functions yesterday to import from different types
of raw data including html and different text formats. In the end I
never used the extract function or the parser module, but your advice
put me on the right track. All these functions are now in a single
object
(objects are not allowed to lie about who they are, or what they are).
Dangit! I need to find a less honest programming language. Anyone
have a Perl cookbook handy? ...
--
http://mail.python.org/mailman/listinfo/python-list
James Stroud wrote:
How do I get the SVN version? Maybe that is not the one I have. This
crashes on the version I have (complete program listing):
abcde.encode('hex')
LookupError: no codec search functions registered: can't find encoding
I am using the latest enthought python and the
201 - 235 of 235 matches
Mail list logo