pyvm 1.4.9
==
More batteries to your python
Introduction:
pyvm is a relocatable python binary distribution containing
several modules. Its main aim is to provide all this without
requiring root access.
Features:
* pyqt (widget set)
* pygtk (widget set)
* nummarray
i have a bunch of files encoded in GB18030. Is there a way to convert
them to utf16 with python?
Xah
[EMAIL PROTECTED]
http://xahlee.org/PageTwo_dir/more.html
--
http://mail.python.org/mailman/listinfo/python-list
is it possible in Python to create a function that maintains a variable
value?
something like this:
globe=0;
def myFun():
globe=globe+1
return globe
apparently it can't be done like that. I thought it can probably be
done by prefixing the variable with some package context...
the Python
Frank Abel Cancio Bello [EMAIL PROTECTED] wrote:
PrettyPrint or Print return the value to the console, and i need
keep this value in a string variable to work with it, how can i
do this?
The second parameter to either of these functions can be a stream
object, so you can use a StringIO to
Xah Lee [EMAIL PROTECTED] wrotE:
i have a bunch of files encoded in GB18030. Is there a way to convert
them to utf16 with python?
You will need CJKCodecs (http://cjkpython.i18n.org/), or Python 2.4,
which has them built in. Then just use them like any other codec. eg.
f= open(path, 'rb')
Xah Lee wrote:
if i understand correctly, forms such as
(lambda x,y:x+y)(a,b)
can only be gained thru experience? and not documented directly
anywhere in the official docs?
The official documentation can't list every possible permutation of the
various syntactic constructs. It does explain
Xah Lee wrote:
globe=0;
def myFun():
globe=globe+1
return globe
The short answer is to use the global statement:
globe=0
def myFun():
global globe
globe=globe+1
return globe
more elegant is:
globe=0
globe=myfun(globe)
def myFun(var):
return var+1
and still more elegant is using classes
Xah Lee [EMAIL PROTECTED] wrote:
is it possible in Python to create a function that maintains a
variable value?
Yes. There's no concept of a 'static' function variable as such, but
there are many other ways to achieve the same thing.
globe=0;
def myFun():
globe=globe+1
return globe
Am Sat, 05 Mar 2005 20:33:22 -0600 schrieb Chris Gonnerman:
http://newcenturycomputers.net/projects/wconio.html
I've done this before:
http://www.pythonwiki.de/PythonErweiterungen/WindowsBinaries
greets,
Marek
--
http://mail.python.org/mailman/listinfo/python-list
Ben Rf wrote:
I'm new to programming and i'd like to write a program that will parse
a list produced by md5summer and give me a report in a text file on
which md5 sums appear more than once and where they are located.
This should do the trick:
import fileinput
md5s = {}
for line in
Michael Hoffman wrote:
$ py24 -m timeit -s floats = map(float, range(1000)) -sfrom itertools
import starmap, izip ints = list(starmap(int, izip(floats)))
1000 loops, best of 3: 343 usec per loop
Truly evil. Why is that faster than ints = list(imap(int, floats))?
It is on my system.
A true
I am making use of a Checkbutton widget. However, I would like to add
an option or method on the fly. For example I would like to bind a
filename (filename.txt) to a particular Checkbutton widget so that I
call it later as:
widget[filename]
Is this possible to do?
Thanks,
Harlin
--
Dfenestr8 [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hi.
I have a program which I want a plugin directory for. I figured the way to
go about that would be to just add a plugin/ dir to sys.path, and import
everything in it. Then my program can just execute the main() method of
each
Here's what I came up with:
#objtest.py
class first:
def __init__(self):
a = 'a'
self.a = a
print self.a
def update(self):
print 'initially, a is', self.a
self.a = second(self.a)
print 'afterwards, a is', self.a.call(self.a)
class
Harlin Seritt wrote:
I am making use of a Checkbutton widget. However, I would like to add
an option or method on the fly. For example I would like to bind a
filename (filename.txt) to a particular Checkbutton widget so that I
call it later as:
widget[filename]
Is this possible to do?
I've got an app that creates an object in its main class (it also
creates a GUI). My problem is that I need to pass this object, a
list, to a dialog that is implemented as a second class. I want to
edit the contents of that list and then pass back the results to the
first class. So my
Timothy Smith [EMAIL PROTECTED] writes:
something strange is happening, no matter what i try nothing is a
supported locale
and yes it's freebsd 4.10
AFAIK, the locale support in FreeBSD 4.1 is incomplete. Support for
LC_NUMERIC was only added in 4.6 - the release notes for 4.6 say:
The
Problem, the focus is on a field which has contents
and I scan the credit card card, which is keyboard input.
The field is altered and a bunch of chars fly acroos the
field. messy.
Ok, I can solve this in a very clumsy manner.
1. I see the first character of the scan, '%',
configure the field to
Actually, lambda forms are quite precisely documented at
http://docs.python.org/ref/lambdas.html if you feel than reading
the tutorial (specifically http://docs.python.org/tut/node6.html
section 4.7.5) is too base for you.
--
http://mail.python.org/mailman/listinfo/python-list
I am using the following code:
for i, f in filelist, self.checkbox:
if f.get():
print i
I am getting an error:
Exception in Tkinter callback
Traceback (most recent call last):
File C:\Python23\lib\lib-tk\Tkinter.py, line 1345, in __call__
return self.func(*args)
File
Would I do this like:
buttondict = {button1, name.txt}
??
Thanks,
Harlin
--
http://mail.python.org/mailman/listinfo/python-list
Both filelist and self.checkbox are the same size (4 items btw). Is
there any way to get this done?
Use zip:
a, b = [1,2,3], ['a', 'b', 'c']
for i,j in zip(a,b):
print i,j
Or from itertools izip - which should be slightly more performant and less
memory consuming.
--
Regards,
Diez B.
On Sunday 06 March 2005 13:09, Harlin Seritt wrote:
for i, f in filelist, self.checkbox:
if f.get():
print i
Use:
for i, f in zip(filelist,self.checkbox):
bla
--
--- Heiko.
pgpuQ4Xv4IUj6.pgp
Description: PGP signature
--
http://mail.python.org/mailman/listinfo/python-list
Harlin Seritt wrote:
Would I do this like:
buttondict = {button1, name.txt}
If you want to but I guess the other way round makes more sense. And the
syntax is wrong, its supposed to be
{key : value, ...}
The point is that you can create buttons as much as you want - in a for loop
for
On 2005-03-06, Stewart Midwinter [EMAIL PROTECTED] wrote:
I've got an app that creates an object in its main class (it also
creates a GUI). My problem is that I need to pass this object, a
list, to a dialog that is implemented as a second class. I want to
edit the contents of that list and
Hi,
I'm using CGIHTTPServer (via its test() method) to test some CGI on my
Windoze 98 box. I find that the execution is very slow. Is there
anything I can do to make sure I'm getting the best performance out of
CGIHTTPServer?
Thanks in advance,
Johan
[EMAIL PROTECTED] (Magnus Lie Hetland) wrote in message news:[EMAIL
PROTECTED]...
In article [EMAIL PROTECTED],
[EMAIL PROTECTED] wrote:
I had a look at the new reference implementation of PEP 246
(Object Adaptation) and I feel uneasy with one specific point
of this new version. I don't
Please
include "goto" command in future python realeses know that proffesional
programers doesn't like to use it, but for me as newbie it's too hard
to get used replacing it with "while", "def" or other commands
--
I believe the bad reputation of 'goto' goes back to
the originators of
In message [EMAIL PROTECTED], I.V.
Aprameya Rao [EMAIL PROTECTED] writes
OK, i forgot to mention this.
The speed is a critical issue because there will be a competition and
whosever solution is faster wins the prize.
Hence will a python solution be as fast as a C++ solution??
aprameya
On 4 Mar
There's a DOS console application I am trying to script (in Python), but it
doesn't seem to use stdout or stderr... For example, if I redirect output
to a file (cmd file.txt), the output still appears on screen.
Similarly, the output pipes returned by popen* don't catch the app's
output. How
Stewart Midwinter wrote:
I've got an app that creates an object in its main class (it also
creates a GUI). My problem is that I need to pass this object, a
list, to a dialog that is implemented as a second class. I want to
edit the contents of that list and then pass back the results to the
first
By using os.spawn* and the os.P_NOWAIT, the spawn function will return
immediately, with the return value being the PID of the new process.
Later, you can use os.kill() to force the program to terminate,
os.waitpid() to retrieve the exit status if it has terminated, or you
could use the signal
Patrick Useldinger wrote:
The short answer is to use the global statement:
globe=0
def myFun():
global globe
globe=globe+1
return globe
more elegant is:
globe=0
globe=myfun(globe)
def myFun(var):
return var+1
This mystifies me. What is myfun()? What is var intended to be?
Kent
--
and make it a singleton, viz:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52558
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/66531
http://www.python.org/2.2.3/descrintro.html
(scroll wayyy down)
--
http://mail.python.org/mailman/listinfo/python-list
|
| Did you perhaps use a list (type(p) == type([])) for p?
|
Alex
Using the coefficients in an array instead of a list
was the key in the solution to my problems
Your other suggestions regarding floating p
and the off-by-one error that I had with the
polynomial
Xah Lee wrote:
is it possible in Python to create a function that maintains a variable
value?
something like this:
globe=0;
def myFun():
globe=globe+1
return globe
You could work with function attributes:
def myFun():
try:myFun.globe += 1
except: myFun.globe = 1
Hi,
If I retrieve the hash of an integer, will it always return the same
value across platforms?
This reason I ask is that I want to produce a sequence of pseudo random
numbers using the random module, that I can re-create later on. So I'll
need to store the seed value, but Random.seed takes a
Xah Lee [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
globe=0;
def myFun():
globe=globe+1
return globe
apparently it can't be done like that. I thought it can probably be
done by prefixing the variable with some package context...
You can do this:
globe=0
def
Will McGugan wrote:
Hi,
If I retrieve the hash of an integer, will it always return the same
value across platforms?
This reason I ask is that I want to produce a sequence of pseudo random
numbers using the random module, that I can re-create later on. So I'll
need to store the seed value, but
Hi,
I'm having some weird issues with Python 2.4 and PyOpenGL 2.0.2.01 (and
also with older versions).
When I call glutGetModifiers from event handler functions (set using
glutMouseFunc, glutMotionFunc etc...), it just says:
GLUT: Warning in foo: glutCurrentModifiers: do not call outside core
If sequences are not same length:
zip truncates to length of shortest input sequence
map(None, seq1, seq2) pads to length of longest seq.
(can't remember what itertools.izip() does)
--
http://mail.python.org/mailman/listinfo/python-list
Sorry, in writing down the problem and the corresponding solution, I
made a mistake. It's evident, but anyway...
Wrong:
# ab * cb = dab 35 * 26 = 936
# + + - + + -
# ifd + chg = eaf179 + 258 = 437
# ---
I believe python docs are quite *un*-stilted. Modules and packages are
not complicated. Read chapter 7 of the nutshell, it's only 10 pages
long. 2.3 and 2.4 didn't introduce any fundamental changes in how
modules work AFAIK
--
http://mail.python.org/mailman/listinfo/python-list
When you run python -i scriptname.py after the script completes you left
at the interactive command prompt.
Is there a way to have this occur from a running program?
In other words can I just run scriptname.py (NOT python -i scriptname.py)
and inside of scriptname.py I decide that I want to
Hello,
Via Xpath, I want to access nodes which have a namespace prefix. THe
document at hand is an Xsl-FO document. I tried the following:
from xml.dom import minidom
from xml.xpath import Evaluate
from xml import sax
parser = sax.make_parser()
parser.setFeature(sax.handler.feature_namespaces,1)
I need some ideas of how to accomplish this task.
I was told that I just need to save the input in a file and make the file
searchable, nothing fancy like tying into SQL or Oracle. THis is a basic
program and help is greatly appreciated:
You've been given an assignment by your supervisor to
I.V. Aprameya Rao [EMAIL PROTECTED] wrote:
Hi
I have to implement a flat file dbms. The basic condition is that
relations will be given in files and i will have to run certain select
project join queries on those relations.
Can someone tell me as to which language will be faster,
map F12 Esc:!d:\python24\python.exe %CR
but it comes with a new pop-up windowsdame~
I'm no windows expert - but maybe pythonw.exe helps here?
I find that using pythonw.exe and the silent prefix in Vim works best
for me:
map F5 Esc:silent !pythonw.exe %CR
Regards,
Aaron
--
Hi,
people here usually tend not to be too helpful when asked to do an obvious
homework task. So if you really want help, provide some code you've already
written and that has actual problems. Then we're glad to help. But don't
expect others to do your work.
--
Regards,
Diez B. Roggisch
--
From http://uche.ogbuji.net/tech/akara/nodes/2003-01-01/basic-xpath
NSS = {u'wsdl': u'http://schemas.xmlsoap.org/wsdl/'}
#processorNss = namespace bindings to be used by the processor
ctx = Context(wsdl_doc, processorNss=NSS)
Evaluate(u'wsdl:description/wsdl:documentation', context=ctx)
Kent Johnson wrote:
globe=0
globe=myfun(globe)
def myFun(var):
return var+1
This mystifies me. What is myfun()? What is var intended to be?
myfun is an error ;-) should be myFun, of course.
var is parameter of function myFun. If you call myFun with variable
globe, all references to var will be
Very simple is you're on UNIX ...
You juste have to put at the beginnin of your file :
#!/usr/bin/python -i
And it juste does what you want :)
Pierre
Joe a écrit :
When you run python -i scriptname.py after the script completes you left
at the interactive command prompt.
Is there a way to have
Patrick Useldinger wrote:
Kent Johnson wrote:
globe=0
globe=myfun(globe)
def myFun(var):
return var+1
This mystifies me. What is myfun()? What is var intended to be?
myfun is an error ;-) should be myFun, of course.
var is parameter of function myFun. If you call myFun with variable
globe,
Hi Pierre,
Thanks for the reply, but I am not on Unix and it even if I was that
solution it does not achieve the desired results.
I want the script to decide whether to fall back to the interactive prompt.
You solution makes it ALWAYS fall back to the interactive prompt.
I want to do
Giovanni Bajo wrote:
Hello,
I noticed that bultin types like list, set, dict, tuple don't seem to adhere to
the convention of using super() in constructor to correctly allow
diamond-shaped inheritance (through MRO). For instance:
class A(object):
... def __init__(self):
... print
Hello,
I'm trying to use IndexedCatalog
[http://www.async.com.br/projects/IndexedCatalog/] in my CherryPy
[http://www.cherrypy.org] application.
As Zodb support access just from one Python thread, I must either use just
one CherryPy thread (slow), or use ZEO. However, if I understand it good,
msoulier wrote:
Well, broadly, the reason is that it allows version-specific code to
be
included in libraries.
I've actually found this to be a bit of a pain. I build packages
against say, python2.2, and if you upgrade python to 2.3 the package
breaks. The code works fine so saying it requires
Joe wrote:
I want the script to decide whether to fall back to the interactive prompt.
You solution makes it ALWAYS fall back to the interactive prompt.
Actually, using sys.exit() means the program can exit even if python -i
is used.
You can use:
import code
code.interact()
which emulates the
Hi,
I have a date string in the ctime() format ('Sat Mar 5 10:38:07 2005')
and I want to know how long ago that was in whole days.
So far I have:
import time
import datetime
age =
(datetime.date.fromtimestamp(time.mktime(time.strptime(date.strip( -
datetime.date.today()).days
Which is an
I posted the following a while back. I think this is what you are
looking for.
This can be done fairly easily by creating a module (lets call it
interactive) with the following code in it.
---
import sys,os
def debug_exception(type, value, traceback):
# Restore redirected standard
Joe wrote:
When you run python -i scriptname.py after the script completes you left
at the interactive command prompt.
Is there a way to have this occur from a running program?
In other words can I just run scriptname.py (NOT python -i scriptname.py)
and inside of scriptname.py I decide that I
I'm using SWIG to generate glue code for my embedded/extended python app.
There are a couple of very frustrating issues that I would like to see if
anyone else has solutions for:
- Once I have created and initialized a module with SWIG I can call it by
executing a python file with no problems.
I'm looking for a widget, to be used with Tkinter, that displays a
tree whose leaves are strings. I thought there was something like that
in the Python Megawidgets, but when I look at the documentation
(http://pmw.sourceforge.net/doc/refindex.html), it doesn't seem to be
there. Any advice will be
Hi Sean,
I downloaded a file called tree.py recently which has this at the top:
# Highly optimized Tkinter tree control
# by Charles E. Gene Cash email gcash at cfl.rr.com
#
# This is documented more fully on my homepage at
# http://home.cfl.rr.com/genecash/ and if it's not there, look in the
Almad wrote:
Hello,
I'm trying to use IndexedCatalog
[http://www.async.com.br/projects/IndexedCatalog/] in my CherryPy
[http://www.cherrypy.org] application.
As Zodb support access just from one Python thread, I must either use just
one CherryPy thread (slow), or use ZEO. However, if I
[EMAIL PROTECTED] writes:
My goal is to install python2.4 using yum (wouldn't you know it, it's a
dependency for something else).
[...]
You're probably better off asking on a yum or Fedora list or
newsgroup.
John
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] writes:
I like the way call tips displays argument variables for functions when
you type the ( after the function name. However, if one of the
arguments to the function is something like SomeMod.attribute, the
intellisense will display all the exposed methods and attributes
Thanks Michael, that's what I was looking for.
Are there any differences between that and the actual interactve prompt that
I should be aware of?
Would you consider that a better method than using (thanks to those who
suggested this other option):
import os
os.environ['PYTHONINSPECT'] = '1'
Actually the sequences are of the same length. Forgot to mention that.
thanks,
Harlin
--
http://mail.python.org/mailman/listinfo/python-list
Actually it should be here:
http://py.vaults.ca/apyllo.py/808292924.247038364.90387689.96972321
Cheers,
Harlin
--
http://mail.python.org/mailman/listinfo/python-list
I'm trying to use IndexedCatalog
[http://www.async.com.br/projects/IndexedCatalog/] in my CherryPy
[http://www.cherrypy.org] application.
As Zodb support access just from one Python thread, I must either use just
one CherryPy thread (slow), or use ZEO. However, if I understand it good,
when
Paul McGuire wrote:
At the risk of beating this into the Pythonic ground, here is a
generator version which collapses the original nested loop into a
single loop, so that break works just fine:
Indeed. For some things I'm still in the pre-generator days of
Python. If I worked at it I think I
Joe wrote:
Are there any differences between that and the actual interactve prompt that
I should be aware of?
I don't know, unfortunately.
Would you consider that a better method than using (thanks to those who
suggested this other option):
import os
os.environ['PYTHONINSPECT'] = '1'
Actually I
John J. Lee wrote:
[EMAIL PROTECTED] writes:
I like the way call tips displays argument variables for functions
when
you type the ( after the function name. However, if one of the
arguments to the function is something like SomeMod.attribute,
the
intellisense will display all the
On 6 Mar 2005 12:02:42 -0800, rumours say that [EMAIL PROTECTED] (Sean
McIlroy) might have written:
I'm looking for a widget, to be used with Tkinter, that displays a
tree whose leaves are strings. I thought there was something like that
in the Python Megawidgets, but when I look at the
In [EMAIL PROTECTED], James Stroud
wrote:
If you are using md5sum, tou can grab the md5 and the filename like such:
myfile = open(filename)
md5sums = []
for aline in myfile.readlines():
md5sums.append(aline[:-1].split( ,1))
md5sums.append(aline[:-1].split(None, 1))
That works too if
Michael Hoffman wrote:
Joe wrote:
Are there any differences between that and the actual interactve prompt that
I should be aware of?
I don't know, unfortunately.
Would you consider that a better method than using (thanks to those who
suggested this other option):
import os
Reinhold,
Interesting.
A key difference between the two is that PYTHONINSPECT will allow you access
to the prompt at the end of your program (assuming no sys.exit or raise
SystemExit) but code.interact() allows you to jump into the program at any
point.
Reinhold Birkenfeld [EMAIL PROTECTED]
Christos TZOTZIOY Georgiou wrote:
Argument against your only in you can only use goto:
http://www.entrian.com/goto/
That is sick.
I'm clearly an amateur at obfuscating Python. Although my
implementation is much simpler. ;)
--
Michael Hoffman
--
http://mail.python.org/mailman/listinfo/python-list
Grant Edwards [EMAIL PROTECTED] diagnosed
Troll.
I first checked my calendar to make sure it wasn't April 1, but some folks just
can't wait, can they.
And another thought: all this use of alphanumeric characters --- aren't we
obfuscating the pure binariness we should all know and love
Funny you said that, because I didn't even bother trying it because I didn't
think it would work either. I figured that python did something internally
when it saw the -i switch. Looks like it just checks for it when it's done
with your code.
One difference between the two methods that I see
Xah Lee [EMAIL PROTECTED] writes:
the Python doc is quite stilted. Where in the python doc is a programer
supposed read about how the package/module system in Python works?
(besides the tutorial that touches it)
The python docs at URL: http://docs.python.org/ref/naming.html are
perfectly
On Sat, 05 Mar 2005 14:32:27 +, rumours say that Michael Hoffman
[EMAIL PROTECTED] might have written:
BOOGIEMAN wrote:
Please include goto command in future python realeses
As has been said before, you can only use goto in Python if
you are using Python with line numbers:
--
http://mail.python.org/mailman/listinfo/python-list
On Sun, 06 Mar 2005 22:52:10 +, rumours say that Michael Hoffman
[EMAIL PROTECTED] might have written:
Christos TZOTZIOY Georgiou wrote:
Argument against your only in you can only use goto:
http://www.entrian.com/goto/
That is sick.
I'm clearly an amateur at obfuscating Python.
Thank both for the help. I understand that I should provide code, I am
still trying to understand what to do, I don't want the work done, just
some ideas of where to go, a general layout perhaps. Thank you.
--
http://mail.python.org/mailman/listinfo/python-list
This is just a basic of what I have so far. The time , a class I will need
and the print function.
class Account:
def __init__(self, initial):
self.balance = initial
def deposit(self, amt):
self.balance = self.balance + amt
def withdraw(self,amt):
Hi there,
I'm pleased to announce the availability of PyKota v1.21 Final.
PyKota is a Print Quota and Accounting solution for CUPS and LPRng,
available from :
http://www.librelogiciel.com/software/PyKota/action_Presentation
PyKota's original distribution method consists in providing Official
Try something like this:
for x in plugs:
cmd = import %s % x
exec (cmd)
Dfenestr8 [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Hi.
I have a program which I want a plugin directory for. I figured the way to
go about that would be to just add a plugin/ dir to
[The HTML version of this Summary is available at
http://www.python.org/dev/summary/2005-02-01_2005-02-14.html]
=
Summary Announcements
=
--
Giving myself a gold watch
--
As some of you may have already heard
Hello Guys,
I am new to the list and to
Python.
I have been reading Oreilly's
Python book and some web page on child process creation
using Python.
Basically, on windows, I want to start a process
and monitor its stdout and stderror.
I have looked at os.py from python lib directory,
and
Gregor [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
There's a DOS console application I am trying to script (in Python), but
it
doesn't seem to use stdout or stderr... For example, if I redirect output
to a file (cmd file.txt), the output still appears on screen.
Similarly,
pls ignore, I got open3 to work, silly mistake on
my part...
dave.
- Original Message -
From:
Dave
Lajoie
To: Python-list@python.org
Sent: Sunday, March 06, 2005 10:32
PM
Subject: Fork on windows
Hello Guys,
I am new to the list and to
Python.
I
Thanks. How do I verify what RPMs I need? I checked with rpm -qa |
python, it only showed the python package. After I included the
/usr/include/sys/io.h in the source package INCLUDE path, it seemed
like the compilation went into a include loop.
(/usr/include/sys/unisted.h:1:10 #include nested too
On Sat, 05 Mar 2005 15:42:23 +1000, Timothy Smith
[EMAIL PROTECTED] wrote:
i'm trying to setlocale() on 4.10, and it appears the python package
doesn't support this under 4.10.
Python 2.3.3 (#2, Apr 28 2004, 22:48:37)
[GCC 2.95.4 20020320 [FreeBSD]] on freebsd4
Type help, copyright, credits
Hi,
I want to do something like the following, which doesn't work:
modulename = 'module'
import modulename
The error is that there is no module named 'modulename'. Is there a
way to get that variable expanded?
Regards,
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On 6 Mar 2005 21:34:08 -0800, Steven Reddie [EMAIL PROTECTED] wrote:
Hi,
I want to do something like the following, which doesn't work:
modulename = 'module'
import modulename
The error is that there is no module named 'modulename'. Is there a
way to get that variable
Hi,
Thanks, that seems to be what I was missing. I'm having some further
related trouble though. I want to do something like this:
MODULES = [ 'module1', 'module2' ]
def libinfo():
for m in MODULES:
__import__('libinfo.'+m)
YL wrote:
Try something like this:
for x in plugs:
cmd = import %s % x
exec (cmd)
For the sake of others who might have missed the rest of this thread,
I'll point out that this is definitely not the way to go. No need to
use exec when the builtin __import__ function is
On Sun, 06 Mar 2005 09:44:41 +0100, Patrick Useldinger
[EMAIL PROTECTED] wrote:
Xah Lee wrote:
globe=0;
def myFun():
globe=globe+1
return globe
The short answer is to use the global statement:
globe=0
def myFun():
global globe
globe=globe+1
return globe
more
1 - 100 of 113 matches
Mail list logo