Hello Tutors,
I'm having trouble understanding the difference between eval and exec.
Can anyone explain it to me please?
Marilyn Davis
--
___
Tutor maillist - [EMAIL PROTECTED]
http://mail.python.org/mailman/listinfo/tutor
>target_dir = 'D:\\backup'
>target = target_dir +"Zipnametoreplacestrftimeformatstring"+ '.zip'
Just noticed this -
target_dir("D:\\backup") + "Zipnametoreplacestrftimeformatstring"+ '.zip'
= D:\\backupZipnametoreplacestrftimeformatstring.zip
No wonder it doesn't work.
Try
target=target_dir
Hi Rankumar -
That's your problem then -
if os.system(zip_command) == 0:
> > > print 'Successful backup to', target
So, os.system() returns 0 for Win 95,98, ME.
For XP, it returns whatever the exit code your programme returns .
So whatever zip returns, is what os.system() returns, which m
Have you looked at the ConfigParser module that was mentioned earlier
today?
Your file fits its format exactly...
But regular expressions can be used, try the intro in my tutorial,
or the excellent HowTo on the Python web site...
Alan G.
- Original Message -
From: "kumar s" <[EMAIL PRO
> Although I have never done so, I believe you can also
> store/manipulate objects in a database.
You can but its a lot slower than memory - but a lot more
scaleale too!
> Has anyone ever worked this option?
Yes, lots of times. In fact most large scale projects will
need to save objects to so
> I've written a class, with some methods. I then want to be able to
call
> the class repeatedly, to create some objects. The number of objects,
and
> some of their initialisation parameters need to be specified later
(i.e.
> at run-time).
Not quite sure what you mean by the last bit but I'll com
Well, you could *try* ;-).
Okay, here's a one-pass approach:
#!/usr/bin/env python
import re
# Regular expressions stolen from PyCookbook:
#
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/132326
sec = re.compile(r'^\[(.*)\]')
eq = re.compile(r'^([^=]+)=(.*)')
def main(fname='file.ini'
On Dec 3, 2004, at 21:34, Rick Muller wrote:
The file type you mention is also called an INI file,
and is used for Windows initialization scripts, among
other things.
There's a nice recipe on this in the Python Cookbook:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65334
This will read y
The file type you mention is also called an INI file,
and is used for Windows initialization scripts, among
other things.
There's a nice recipe on this in the Python Cookbook:
http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65334
This will read your file in as a dictionary. You can
then d
Dear group,
I have a file with 645,984 lines. This file is
composedcompletely of bocks.
For e.g.
[Unit111]
Name=NONE
Direction=2
NumAtoms=16
NumCells=32
UnitNumber=111
UnitType=3
NumberBlocks=1
[Unit111_Block1]
Name=31318_at
BlockNumber=1
NumAtoms=16
NumCells=32
StartPosition=0
StopPosition=1
Sure is.
Try cx_freeze.
It can be found at
http://starship.python.net/crew/atuining/cx_Freeze/index.html .
I've used it with great success.
Thank you,
Andrew Robert
Systems Architect
Information Technology - OpenVMS
Massachusetts Financial Services
Phone: 617-954-5882
Pager: 781-764-7321
E
I have created a simple python game and I would like
to convert it into a binary executable that can be
used to play it in Linux without needing the various
libraries (pygame etc). Is this possible ?
___
Win a castle for
On Fri, 3 Dec 2004, Mike Hansen wrote:
> That rooted out the problem. A while ago, I changed the colors to kind
> of match my VIM color theme(ps_color). When I did
> idlelib.PyShell.main(), IDLE came up with my custom color theme.
> However, there was a bunch of warnings about my theme. From IDL
That rooted out the problem. A while ago, I changed the colors to kind
of match my VIM color theme(ps_color). When I did
idlelib.PyShell.main(), IDLE came up with my custom color theme.
However, there was a bunch of warnings about my theme. From IDLE, I
deleted the theme. Now IDLE will launch n
Although I have never done so, I believe you can also store/manipulate
objects in a database.
Has anyone ever worked this option?
Thank you,
Andrew Robert
Systems Architect
Information Technology - OpenVMS
Massachusetts Financial Services
Phone: 617-954-5882
Pager: 781-764-7321
E-mail: [EMAI
If you want to be able to access the objects by name, you can put them in a
dict. For example,
MyObjects={}
l=["a","b","c"]
for i in l:
MyObjects[i] = MyClass(i)
Then you can refer to MyObjects["a"]
If all the operations on the objects are done to all objects in a batch, putting them in a
Dear Tutor-list,
I'm sorry for this appallingly dumb question, but I'm having a little
problem with objects.
I've written a class, with some methods. I then want to be able to call
the class repeatedly, to create some objects. The number of objects, and
some of their initialisation parameters nee
I have only 2 word documents in both the directories, i tried removing
'-qr' too, but no change, no zip files formed. i'm using windows XP.
On Thu, 2 Dec 2004 23:54:11 -0800 (PST), Danny Yoo
<[EMAIL PROTECTED]> wrote:
> Hi Ramkumar,
>
> I'm forwarding your message to Python-tutor; in your repli
> >Yowza; that's some bug. Danny, do you happen to know the bug number?
> >I can't find it on sourceforge.
>
> It's been like that since 2.3 as far as I know. It generates a
> connection to localhost to run code in a separate environment.
Hi Mike,
I wish I knew what the problem was in better d
On Thu, 2 Dec 2004, Kent Johnson wrote:
> makeSuite() creates a TestSuite object that consolidates all the test
> methods of the class named by the first argument. Test methods are
> identified by having names starting with the second argument.
[text cut]
The unit testing framework is closely
On Thu, 2 Dec 2004, Daniel wrote:
> I need to know how to run another module through one
Hi Daniel,
Have you had a chance to look at one of the tutorials on:
http://www.python.org/moin/BeginnersGuide_2fNonProgrammers
I'm guessing that youe trying to use modules; most of the tutorials sh
mdcooper wrote:
Hello,
I am trying to append a list to another list, but everytime I do, the new
parent list has a new child list, but all the other lists have become the same
as the new child list.
Code:
self._f.write(str(self.residue.atoms[int(t[0])-1].element) + ' ')
for m in t:
> I need to know how to run another module through one what is the
command do
> I have to include a path name and if there is any special way I have
to save
> the file
See my tutor for more info on modules and functions.
The short answer is that if you create a module
(ie a python file) and put
On Thu, 2 Dec 2004, Jacob S. wrote:
> If you or anybody else is interested, I've written a script for codes like
> kids in junior high use to write notes to each other with...
Hi Jacob,
Cool! Do you mind if I make some comments on the code? If you do mind...
um... skip this message. *grin*
> I thought that the '.py ' in this import statement would make the
> interpreter think that newline was a package and therefore try to
recognize
> py as a module in the newline package.
>
> from newline.py import newline
Quite right it should have been
from newline import mnewline!
oops, sorry
25 matches
Mail list logo