Re: [Tutor] Question on how to do something.

2008-07-18 Thread Jerry Hill
On Thu, Jul 17, 2008 at 6:39 PM, Mitchell Nguyen <[EMAIL PROTECTED]> wrote: > Hello. I'm new to Python and I was wondering how to read all the files in a > folder. I used this program or command for single files. > > And if possible, is there a way to make it so that it waits at the end of > each f

Re: [Tutor] Question on how to do something.

2008-07-17 Thread Alan Gauld
"Mitchell Nguyen" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Hello. I'm new to Python and I was wondering how to read all the files in a folder. Take a look at the fileinput module, I think it will do what you want. Alan G ___

[Tutor] Question on how to do something.

2008-07-17 Thread Mitchell Nguyen
Hello. I'm new to Python and I was wondering how to read all the files in a folder. I used this program or command for single files. import pprint pprint.pprint(open(r'c:\text\somefile.txt').readlines()) And if possible, is there a way to make it so that it waits at the end of each file for a

Re: [Tutor] Question about string

2008-07-03 Thread Michael yaV
tion (concatenation) is done which is a much more expensive operation in terms of computer power. The first is only possible if you have literal strings but the second can be used for variables: s1 = 'a' s2 = 'b' s = s1 s2 # doesn't work s = s1 + s2 # works HTH,

Re: [Tutor] Question about string

2008-07-03 Thread Dong Li
> Date: Thu, 3 Jul 2008 10:18:23 +0100 > From: "Alan Gauld" <[EMAIL PROTECTED]> > Subject: Re: [Tutor] Question about string > To: tutor@python.org > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; format=flowed; charset="iso-8859-1&q

Re: [Tutor] Question about string

2008-07-03 Thread Monika Jisswel
Python is one of the smartest languages, it does many things for the programmer (I don't know but this might be what they mean with Batteries-Included) , & you have just scratched the surface of it, here python concatenated your strings together for you, later you will meet list comprehention & o

Re: [Tutor] Question about string

2008-07-03 Thread Alan Gauld
"Dong Li" <[EMAIL PROTECTED]> wrote I am new to python, so what I ask may be so basic. I don't know the difference between s = 'a' 'b' and s = 'a'+'b' They have the same results. Thanks for relying! I think the differencec is that the first is purely a syntax thing so the interpreter does t

[Tutor] Question about string

2008-07-02 Thread Dong Li
Hi, everyone I am new to python, so what I ask may be so basic. I don't know the difference between s = 'a' 'b' and s = 'a'+'b' They have the same results. Thanks for relying! ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/li

Re: [Tutor] Question about global variables on modules

2008-04-07 Thread Dave Kuhlman
On Fri, Apr 04, 2008 at 10:25:30PM -0300, Tiago Katcipis wrote: > I know its not such a pretty thing to have global variables but its only > for an exercise my teacher told to do. Its a function to calculate the > results of a matrix using jacob. I want to inside the module (inside a > function on

[Tutor] Question about global variables on modules

2008-04-06 Thread Tiago Katcipis
I know its not such a pretty thing to have global variables but its only for an exercise my teacher told to do. Its a function to calculate the results of a matrix using jacob. I want to inside the module (inside a function on the module )assign a value to a global variable, but the only way i foun

Re: [Tutor] Question about global variables on modules

2008-04-05 Thread Alan Gauld
"Tiago Katcipis" <[EMAIL PROTECTED]> wrote > results of a matrix using jacob. I want to inside the module (inside > a > function on the module )assign a value to a global variable, but the > only way i found to do this inside the own module function is > importing > the module inside himself. Is

Re: [Tutor] Question about global variables on modules

2008-04-04 Thread Anthony Baldwin
Tiago Katcipis wrote: > I know its not such a pretty thing to have global variables but its only > for an exercise my teacher told to do. Its a function to calculate the > results of a matrix using jacob. I want to inside the module (inside a > function on the module )assign a value to a global var

[Tutor] Question about global variables on modules

2008-04-04 Thread Tiago Katcipis
I know its not such a pretty thing to have global variables but its only for an exercise my teacher told to do. Its a function to calculate the results of a matrix using jacob. I want to inside the module (inside a function on the module )assign a value to a global variable, but the only way i foun

Re: [Tutor] Question about Python ORM

2008-04-02 Thread Michael Langford
If you do sqlalchemy, I recommend you at least also look at sqlsoup to help making your mappings easier: http://www.sqlalchemy.org/trac/wiki/SqlSoup If you don't want to write mappers and you don't need the relational database, ZODB also works: http://www.zope.org/Products/StandaloneZODB

Re: [Tutor] Question about Python ORM

2008-04-02 Thread Andreas Kostyrka
There are many as you said yourself. Recommendation: sqlalchemy.org Andreas Am Mittwoch, den 02.04.2008, 16:51 +0530 schrieb hiren kumar: > Hi, > > I am very much new to Python and it's available framework. > > When I search the over net about Python ORM, I found there are so many > ORMs availa

[Tutor] Question about Python ORM

2008-04-02 Thread hiren kumar
Hi, I am very much new to Python and it's available framework. When I search the over net about Python ORM, I found there are so many ORMs available and I was confused between them? I don't understand where to go? :( Can you please tell me something about Python ORM? Regards, Kumar

Re: [Tutor] question concerning Boolean operators

2008-03-20 Thread Alan Gauld
"Guba" <[EMAIL PROTECTED]> wrote > >>> string1, string2, string3 = '', 'Trondheim', 'Hammer Dance' > >>> non_null = string1 or string2 or string3 > >>> non_null > 'Trondheim' > > How does this work?? How does Python know that we are looking for > non_null? After all, we don't provide this informa

Re: [Tutor] question concerning Boolean operators

2008-03-20 Thread Steve Willoughby
On Thu, Mar 20, 2008 at 04:55:17PM -0700, jim stockford wrote: > >>> string1, string2, string3 = '', 'Trondheim', 'Hammer Dance' > >>> jackson = string1 or string2 or string3 > >>> jackson > 'Trondheim' The key here is the "or" operator which, in an expression like a or b will return a if

Re: [Tutor] question concerning Boolean operators

2008-03-20 Thread jim stockford
i'm guessing assignment, which actually associates a reference, will skip referencing an identifier to a null and will make the association (assignment) to the first non-null value in the expression, which is string2 in this case. that the identifier is non_null is immaterial; you could write

[Tutor] question concerning Boolean operators

2008-03-20 Thread Guba
Dear list, from Guido's tutorial: It is possible to assign the result of a comparison or other Boolean expression to a variable. For example, >>> string1, string2, string3 = '', 'Trondheim', 'Hammer Dance' >>> non_null = string1 or string2 or string3 >>> non_null

Re: [Tutor] [tutor] Question on multithreading

2008-02-26 Thread Kent Johnson
Varsha Purohit wrote: > Hello, > i have a gui program in wxpython where i am spawning two threads. > one for the mainloop of gui and other for some background tasks. It is unusual to start a new thread for the GUI. Usually the GUI is run in the main application thread. > I have > to stop th

Re: [Tutor] Question on multithreading

2008-02-24 Thread Thomas Pani
Hi, Here are some thoughts: From the Python Library Reference: "If the subclass overrides the constructor, it must make sure to invoke the base class constructor (Thread.__init__()) before doing anything else to the thread." You'll have to do that for your GuiScript class. You can't just sto

[Tutor] [tutor] Question on multithreading

2008-02-23 Thread Varsha Purohit
Hello, i have a gui program in wxpython where i am spawning two threads. one for the mainloop of gui and other for some background tasks. I have to stop the background running thread once its work is done. I am trying to use the join method but it is giving me an error saying threads cannot be

Re: [Tutor] Question regarding list editing (in place)

2008-02-14 Thread David J. Weller-Fahy
Sorry for the delayed reply - the list software was "helping" me by not sending me the list copy. Heh. * Kent Johnson <[EMAIL PROTECTED]> [2008-02-05 13:43]: > bob gailer wrote: >> dirs = [dir for dir in dirs if not dir.startswith(u'.')] > > Except to filter the directory list for os.walk() you

Re: [Tutor] Question regarding list editing (in place)

2008-02-05 Thread Kent Johnson
bob gailer wrote: > dirs = [dir for dir in dirs if not dir.startswith(u'.')] Except to filter the directory list for os.walk() you have to modify the list in place. Use this: dirs[:] = [dir for dir in dirs if not dir.startswith(u'.')] Kent ___ Tutor ma

Re: [Tutor] Question regarding list editing (in place)

2008-02-05 Thread bob gailer
David J. Weller-Fahy wrote: > Let me know if this should be on the general python list. > > I'm playing with some python to iterate over a directory structure. Part > of the directory structure should be ignored, and will have a period (.) > as the first character of the directory name. > > My s

[Tutor] Question regarding list editing (in place)

2008-02-05 Thread David J. Weller-Fahy
Let me know if this should be on the general python list. I'm playing with some python to iterate over a directory structure. Part of the directory structure should be ignored, and will have a period (.) as the first character of the directory name. My solution was to use the following code. #

Re: [Tutor] [tutor] Question on multithreading

2008-01-29 Thread bob gailer
Varsha Purohit wrote: > Hello friends, > I hve a GUI where i have start button and stop button. When i > press start button one thread is created and it is executing some > background task and when i press stop button that thread is > stopped/killed. These two things are working properly

Re: [Tutor] [tutor] Question on multithreading

2008-01-29 Thread John Fouhy
On 30/01/2008, Varsha Purohit <[EMAIL PROTECTED]> wrote: > Hello friends, > I hve a GUI where i have start button and stop button. When i press > start button one thread is created and it is executing some background task > and when i press stop button that thread is stopped/killed. These t

[Tutor] [tutor] Question on multithreading

2008-01-29 Thread Varsha Purohit
Hello friends, I hve a GUI where i have start button and stop button. When i press start button one thread is created and it is executing some background task and when i press stop button that thread is stopped/killed. These two things are working properly. But i have to implement pause but

Re: [Tutor] question about a number and bytes.

2008-01-29 Thread shawn bright
ok, was using pyserial, but was not using struct.pack. thanks sk On Jan 29, 2008 3:16 PM, Michael Langford <[EMAIL PROTECTED]> wrote: > Use pyserial: > > http://pyserial.sourceforge.net/ > > Use struct.pack: > > http://docs.python.org/lib/module-struct.html > > The format string will depend whethe

Re: [Tutor] question about a number and bytes.

2008-01-29 Thread Michael Langford
Use pyserial: http://pyserial.sourceforge.net/ Use struct.pack: http://docs.python.org/lib/module-struct.html The format string will depend whether you need little or big endian. --Michael On Jan 29, 2008 4:13 PM, shawn bright <[EMAIL PROTECTED]> wrote: > Thanks for your reply. > i ne

Re: [Tutor] question about a number and bytes.

2008-01-29 Thread shawn bright
Thanks for your reply. i need to do this in python because python is what scripting language our data I/O system is written in. i am writing a command out over a serial port that tells an RTU to change part of it's program. I am not sure what you mean by using it in any other python context, this i

Re: [Tutor] question about a number and bytes.

2008-01-29 Thread Tiger12506
> Hello there all. > > I have a need to make a hi byte and lo byte out of a number. > > so, lets say i have a number 300, and need this number to be > represented in two bytes, how do i go about that? First question. Why would you need to do this in python? Second question. If you could do that,

[Tutor] question about a number and bytes.

2008-01-29 Thread shawn bright
Hello there all. I have a need to make a hi byte and lo byte out of a number. so, lets say i have a number 300, and need this number to be represented in two bytes, how do i go about that? thanks for any tips, sk ___ Tutor maillist - Tutor@python.or

Re: [Tutor] question re type()

2007-10-31 Thread Aditya Lal
On 10/31/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > > Aditya Lal wrote: > > On 10/29/07, *Kent Johnson* <[EMAIL PROTECTED] > > wrote: > > > - Common Python practice is to prefer the least restrictive type > check > > possible. > > > I completely agree that the c

Re: [Tutor] question re type()

2007-10-31 Thread Kent Johnson
Aditya Lal wrote: > On 10/29/07, *Kent Johnson* <[EMAIL PROTECTED] > > wrote: > - Common Python practice is to prefer the least restrictive type check > possible. > I completely agree that the check " type(n) == int " is very intuitive > and simple. Its just th

Re: [Tutor] question re type()

2007-10-30 Thread Aditya Lal
On 10/29/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > > Aditya Lal wrote: > > or use types module > > > > import types > > > > if type(n) == types.IntType or type(n) == types.LongType : > > blah! > > A few notes: > - If you look at types.py, you find > IntType = int > LongType = long > > and s

Re: [Tutor] question re type()

2007-10-29 Thread Kent Johnson
Aditya Lal wrote: > or use types module > > import types > > if type(n) == types.IntType or type(n) == types.LongType : > blah! A few notes: - If you look at types.py, you find IntType = int LongType = long and so on for all the built-in types, so there is no need or advantage to importin

Re: [Tutor] question re type()

2007-10-27 Thread Dick Moores
At 11:34 AM 10/27/2007, Dave Kuhlman wrote: >On Sat, Oct 27, 2007 at 01:03:18PM +0100, Alan Gauld wrote: > > > if type(n) == int > > > > Or just use an instance of the same type: > > > > if type(n) == type(42) > >Calling type(n) for any integer seems to return the same object. >I checked with id().

Re: [Tutor] question re type()

2007-10-27 Thread Alan Gauld
"Dave Kuhlman" <[EMAIL PROTECTED]> wrote > Calling type(n) for any integer seems to return the same object. > I checked with id(). I would hope so since they are all of the same type. It thus makes sense that they all return a reference to the same type object. > So, should we be using: > >

Re: [Tutor] question re type()

2007-10-27 Thread Dave Kuhlman
On Sat, Oct 27, 2007 at 01:03:18PM +0100, Alan Gauld wrote: > > "Dick Moores" <[EMAIL PROTECTED]> wrote > > > if type(n) == 'int' or type(n) == 'long': > > do something > > don't use strings > > if type(n) == int > > Or just use an instance of the same type: > > if type(n) == type(42) Call

Re: [Tutor] question re type()

2007-10-27 Thread Aditya Lal
On 10/27/07, Alan Gauld <[EMAIL PROTECTED]> wrote: > > > "Dick Moores" <[EMAIL PROTECTED]> wrote > > > if type(n) == 'int' or type(n) == 'long': > > do something > > don't use strings > > if type(n) == int > > Or just use an instance of the same type: > > if type(n) == type(42) > > Alan G. > > __

Re: [Tutor] question re type()

2007-10-27 Thread Alan Gauld
"Dick Moores" <[EMAIL PROTECTED]> wrote > if type(n) == 'int' or type(n) == 'long': > do something don't use strings if type(n) == int Or just use an instance of the same type: if type(n) == type(42) Alan G. ___ Tutor maillist - Tutor@python.o

Re: [Tutor] question re type()

2007-10-27 Thread Dick Moores
At 04:34 AM 10/27/2007, Ricardo Aráoz wrote: >Just take the quotes off : > >if type(n) == int or type(n) == long : Thanks. I tried a lot of things, but not that one! Dick >HTH Oh, yeah! ___ Tutor maillist - Tutor@python.org http://mail.python.org/

Re: [Tutor] question re type()

2007-10-27 Thread Ricardo Aráoz
Dick Moores wrote: > I can't figure out how to test a variable n for its type. > > An example that is the wrong syntax, but shows what I want to do: > > if type(n) == 'int' or type(n) == 'long': >do something > > elif type(n) == 'float': >do something else > > elif type(n) == 'str': >

[Tutor] question re type()

2007-10-27 Thread Dick Moores
I can't figure out how to test a variable n for its type. An example that is the wrong syntax, but shows what I want to do: if type(n) == 'int' or type(n) == 'long': do something elif type(n) == 'float': do something else elif type(n) == 'str': do something different What's the correc

Re: [Tutor] Question about default values for arguments

2007-10-11 Thread Alan Gauld
"Roy Chen" <[EMAIL PROTECTED]> wrote > def f(a, L=[]): >L.append(a) >return L This creates a single list object L used for all calls to f() that don;t provide an explicit L. Thus each call appends to the same object. > > def g(a, L=None): > if L == None: > L = [] > L.app

Re: [Tutor] Question about default values for arguments

2007-10-11 Thread Kent Johnson
Roy Chen wrote: > Hi everyone, been looking at the following functions, but can't > figure out how they work. > > def f(a, L=[]): > L.append(a) > return L > > def g(a, L=None): > if L == None: > L = [] > L.append(a) > return L http://effbot.org/pyfaq

[Tutor] Question about default values for arguments

2007-10-11 Thread Roy Chen
Hi everyone, been looking at the following functions, but can't figure out how they work. def f(a, L=[]): L.append(a) return L def g(a, L=None): if L == None: L = [] L.append(a) return L print f(1) print f(2) print f(3) print g(1) print g

Re: [Tutor] Question about installing 2.51

2007-08-27 Thread Dick Moores
At 02:00 PM 8/27/2007, Alan Gauld wrote: >"Dick Moores" <[EMAIL PROTECTED]> wrote > > > installation process (which I aborted), I was told, "This Update > > will > > replace your existing Python25 installation". > > > > What exactly does this mean? What will happen, for example, to all > > my > >

Re: [Tutor] Question about installing 2.51

2007-08-27 Thread Alan Gauld
"Dick Moores" <[EMAIL PROTECTED]> wrote > installation process (which I aborted), I was told, "This Update > will > replace your existing Python25 installation". > > What exactly does this mean? What will happen, for example, to all > my > scripts that are in E:\Python25\dev? Or to the packages

Re: [Tutor] Question about installing 2.51

2007-08-27 Thread Kent Johnson
Dick Moores wrote: > XP, Python 2.5 > > I just downloaded python-2.5.1.msi from python.org. During the > installation process (which I aborted), I was told, "This Update will > replace your existing Python25 installation". > > What exactly does this mean? What will happen, for example, to all m

[Tutor] Question about installing 2.51

2007-08-27 Thread Dick Moores
XP, Python 2.5 I just downloaded python-2.5.1.msi from python.org. During the installation process (which I aborted), I was told, "This Update will replace your existing Python25 installation". What exactly does this mean? What will happen, for example, to all my scripts that are in E:\Python2

Re: [Tutor] Question about calling functions

2007-08-26 Thread Alan Gauld
"Ara Kooser" <[EMAIL PROTECTED]> wrote > a character works except for one part. You have a choice of > excepting > a set of numbers. If you choose n then the program dumps you into: > def navy() instead of going back to def upp(). > > print upp() > print """You have a chance to reroll if needed."

[Tutor] Question about calling functions

2007-08-26 Thread Ara Kooser
Hello, After taking some suggestions from bhaaluu my program for generating a character works except for one part. You have a choice of excepting a set of numbers. If you choose n then the program dumps you into: def navy() instead of going back to def upp(). I am guessing this has to do with h

Re: [Tutor] Question about classes

2007-08-25 Thread Kent Johnson
Ara Kooser wrote: > Hello all, > >I am working on trying to understand classes by creating a > character generator for a rpg. I know I am doing something silly but I > am not sure what. This is a procedural program wrapped in a class declaration. Just get rid of "class Main:" and outdent ev

Re: [Tutor] Question about classes

2007-08-25 Thread Alan Gauld
"Eric Abrahamsen" <[EMAIL PROTECTED]> wrote >> Welcome to the wacky world of recursion. >> You call __upp from inside __upp so you do indeed generate >> a new layer, in fact you start a new while loop. You need to > > So all those "yes"s were actually backing out of multiple while > loops... Shoul

Re: [Tutor] Question about classes

2007-08-25 Thread Eric Abrahamsen
> Welcome to the wacky world of recursion. > You call __upp from inside __upp so you do indeed generate > a new layer, in fact you start a new while loop. You need to > move the while loop out into init, something like this: So all those "yes"s were actually backing out of multiple while loops..

Re: [Tutor] Question about classes

2007-08-25 Thread Alan Gauld
"Eric Abrahamsen" <[EMAIL PROTECTED]> wrote > The new problem is the while loop inside __upp. Every time I say > "no", and it generates a new set of attributes, it seems to add > another "layer" of unfinished = True, so that once I've got > attributes I like, I need to say "yes" as many times as

Re: [Tutor] Question about classes

2007-08-25 Thread Eric Abrahamsen
On Aug 25, 2007, at 12:59 PM, Ara Kooser wrote: > Hello all, > >I am working on trying to understand classes by creating a > character generator for a rpg. I know I am doing something silly but I > am not sure what. When I run the program I and type no when prompted I > get the following messa

Re: [Tutor] Question about classes

2007-08-25 Thread Alan Gauld
"Ara Kooser" <[EMAIL PROTECTED]> wrote > I am working on trying to understand classes by creating a > character generator for a rpg. You are so ar off base at the moment that I suggest you go back to basics and try a much simpler class. Your MAIN is not really a class at all, it's a function

Re: [Tutor] Question about classes

2007-08-24 Thread Noufal Ibrahim
Ara Kooser wrote: > Hello all, > >I am working on trying to understand classes by creating a > character generator for a rpg. I know I am doing something silly but I > am not sure what. When I run the program I and type no when prompted I > get the following message: > Traceback (most recent c

[Tutor] Question about classes

2007-08-24 Thread Ara Kooser
Hello all, I am working on trying to understand classes by creating a character generator for a rpg. I know I am doing something silly but I am not sure what. When I run the program I and type no when prompted I get the following message: Traceback (most recent call last): File "/Users/ara/Do

Re: [Tutor] Question re Tutor List Etiquette

2007-08-14 Thread William O'Higgins Witteman
On Tue, Aug 14, 2007 at 08:11:33PM +0100, Tom Fitzhenry wrote: >On Tue, Aug 14, 2007 at 11:06:05AM -0700, Dick Moores wrote: >> Replying only to the list takes a bit of trouble. The default >> behavior seems to be that the "Reply" button addresses the author >> only and not the list; "Reply to al

Re: [Tutor] Question re Tutor List Etiquette

2007-08-14 Thread Carroll, Barry
> Date: Tue, 14 Aug 2007 12:33:16 -0700 > From: Dick Moores <[EMAIL PROTECTED]> > Subject: Re: [Tutor] Question re Tutor List Etiquette > To: tutor@python.org > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; charset="us-ascii"; format=flowed

Re: [Tutor] Question re Tutor List Etiquette

2007-08-14 Thread Dick Moores
At 11:56 AM 8/14/2007, Kent Johnson wrote: >Dick Moores wrote: > > When sending a reply to a post, to the list, should we also address > > the reply to the author of the post to which we are replying? > > (There's gotta be an easier way to say that..) If we do so, then the > > author gets a duplica

Re: [Tutor] Question re Tutor List Etiquette

2007-08-14 Thread Tom Fitzhenry
On Tue, Aug 14, 2007 at 11:06:05AM -0700, Dick Moores wrote: > Replying only to the list takes a bit of trouble. The default > behavior seems to be that the "Reply" button addresses the author > only and not the list; "Reply to all" addresses both the list, the > author, and any others included

Re: [Tutor] Question re Tutor List Etiquette

2007-08-14 Thread Kent Johnson
Dick Moores wrote: > When sending a reply to a post, to the list, should we also address > the reply to the author of the post to which we are replying? > (There's gotta be an easier way to say that..) If we do so, then the > author gets a duplicate of our reply. This is configurable for each s

Re: [Tutor] Question re Tutor List Etiquette

2007-08-14 Thread Luke Paireepinart
Dick Moores wrote: > When sending a reply to a post, to the list, should we also address > the reply to the author of the post to which we are replying? > (There's gotta be an easier way to say that..) If we do so, then the > author gets a duplicate of our reply. > > I've run some statistics (bu

Re: [Tutor] Question re Tutor List Etiquette

2007-08-14 Thread Eric Brunson
Dick Moores wrote: > When sending a reply to a post, to the list, should we also address > the reply to the author of the post to which we are replying? > (There's gotta be an easier way to say that..) If we do so, then the > author gets a duplicate of our reply. > > I've run some statistics (bu

[Tutor] Question re Tutor List Etiquette

2007-08-14 Thread Dick Moores
When sending a reply to a post, to the list, should we also address the reply to the author of the post to which we are replying? (There's gotta be an easier way to say that..) If we do so, then the author gets a duplicate of our reply. I've run some statistics (but no more bar graphs ;-) ). My

Re: [Tutor] question about datetime object

2007-07-20 Thread Kent Johnson
shawn bright wrote: > Hello there, > > if i have a python datetime object, what is the easiest way to make it > into epoch seconds ? impIn [1]: import datetime In [2]: now = datetime.datetime.now() In [4]: now.timetuple() Out[4]: (2007, 7, 20, 11, 56, 58, 4, 201, -1) In [5]: import calendar In [

[Tutor] question about datetime object

2007-07-20 Thread shawn bright
Hello there, if i have a python datetime object, what is the easiest way to make it into epoch seconds ? thanks ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Question from a newbie

2007-07-18 Thread Darren Williams
n for testing lines of code up until then. - Original Message - From: "Luke Paireepinart" <[EMAIL PROTECTED]> To: "Junaid.Khan/Finance/Lahore" <[EMAIL PROTECTED]> Cc: Sent: Wednesday, July 18, 2007 10:40 AM Subject: Re: [Tutor] Question from a newbie Jun

Re: [Tutor] Question from a newbie

2007-07-18 Thread Luke Paireepinart
Junaid.Khan/Finance/Lahore wrote: > > Hi > > I am totally new to Python. I downloaded it and I really like it as > its very simple but I came across a small problem. My question is: > > How can I save something in Python. I tried to save it but it don’t > save it. Even I tried to add *.py as exte

[Tutor] Question from a newbie

2007-07-18 Thread Junaid.Khan/Finance/Lahore
Hi I am totally new to Python. I downloaded it and I really like it as its very simple but I came across a small problem. My question is: How can I save something in Python. I tried to save it but it don't save it. Even I tried to add *.py as extension in the end of file name but still it doesn't

Re: [Tutor] Question about lambda and new.instancemethod

2007-07-17 Thread Kent Johnson
Tino Dai wrote: > Hi Everybody, > > I have been working on a parser for myself. I want to create > methods on the fly with the information that I get from a file. Here is > my question: > > class configure: > <.stuff deleted..> > def parseGlobal(self,projectName,s

Re: [Tutor] Question about code reviews

2007-07-15 Thread Kent Johnson
Tino Dai wrote: > Actually, I'm looking for two things: > > I can do stuff with python, but a) is there a better way to do it? b) > What in python don't I know that I don't know. Does that make sense? Reading other people's code is another good way to learn both of these. I found reading the pr

Re: [Tutor] Question

2007-07-13 Thread Alan Gauld
"Luke Paireepinart" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > >> Try >> >> tfile.write(str(i)+'\n') >> >> OR >> >> tfile.write( "d\n" % i) > Alan meant tfile.write("%d\n" % i) of course ;) Which is why we should always include the list on replies! Thanks for catching that o

Re: [Tutor] Question about code reviews

2007-07-13 Thread Tino Dai
On 7/12/07, Tiger12506 <[EMAIL PROTECTED]> wrote: >> >> > Do you know of any service or person that could do a code review >> > for me? >> >> Perhaps if you were more specific about what you are looking for in the >> review? If you merely want something to check your code for possible >> er

Re: [Tutor] Question

2007-07-13 Thread Luke Paireepinart
> Try > > tfile.write(str(i)+'\n') > > OR > > tfile.write( "d\n" % i) Alan meant tfile.write("%d\n" % i) of course ;) -Luke ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Question

2007-07-12 Thread ALAN GAULD
Including the list... - Original Message From: Que Prime <[EMAIL PROTECTED]> To: Alan Gauld <[EMAIL PROTECTED]> > Thank you Alan, but I'm still having difficulty. > I think you mean this but there must be something that I'm misunderstanding. > > print "Creating txt file" > tfile

Re: [Tutor] Question regarding syntax

2007-07-12 Thread John Morris
On 7/11/07, Andre Roberge <[EMAIL PROTECTED]> wrote: It is a standard convention. Lots of tools are built on the assumption that translatable strings are going to be enclosed in _(...) These tools extract the strings from programs, and put them in files (.po) that are easily editable by human

Re: [Tutor] Question

2007-07-12 Thread Alan Gauld
"Que Prime" <[EMAIL PROTECTED]> wrote > Here is what I have so far but can't seem to get the loop and > write correct. I suspect you have used another language before and Python's for loop is foxing you. > print "Creating txt file" > tfile = open("25.txt", "w") > > for i in range(25): >

[Tutor] Question

2007-07-12 Thread Que Prime
I'm trying to create a program that creates a file and write the number for each line. Here is what I have so far but can't seem to get the loop and write correct. Thanks in advance. print "Creating txt file" tfile = open("25.txt", "w") for i in range(25): x = int(1) tfile.writelines("x

Re: [Tutor] Question about code reviews

2007-07-12 Thread Tiger12506
>> >> > Do you know of any service or person that could do a code review >> > for me? >> >> Perhaps if you were more specific about what you are looking for in the >> review? If you merely want something to check your code for possible >> errors and how well you stick to standards, then look i

Re: [Tutor] Question about code reviews

2007-07-12 Thread Tino Dai
On 7/12/07, Adam A. Zajac <[EMAIL PROTECTED]> wrote: > Do you know of any service or person that could do a code review > for me? Perhaps if you were more specific about what you are looking for in the review? If you merely want something to check your code for possible errors and how well

Re: [Tutor] Question about code reviews

2007-07-12 Thread Adam A. Zajac
> Do you know of any service or person that could do a code review > for me? Perhaps if you were more specific about what you are looking for in the review? If you merely want something to check your code for possible errors and how well you stick to standards, then look into pylint or pychec

Re: [Tutor] Question regarding syntax

2007-07-11 Thread Alan Gauld
"John Morris" <[EMAIL PROTECTED]> wrote > So, any really good tutorials on FP and map, filter, zip, lambda ? > I'm trying to wrap my mind around those better... You can try my FP topic in my tutor. Its not the last word but there are an excellent series of FP articles on the IBM Python 'blog'

Re: [Tutor] Question regarding syntax

2007-07-11 Thread Andre Roberge
On 7/11/07, Eric Brunson <[EMAIL PROTECTED]> wrote: > Michael Klier wrote: > > Dave Kuhlman wrote: > > > >> On Wed, Jul 11, 2007 at 11:03:18AM -0400, John Morris wrote: > >> > >>> I'm editing some code from Mailman and seeing: > >>> > >>> legend = _("%(hostname)s Mailing Lists") > >>> > >>> > > > >

Re: [Tutor] Question regarding syntax

2007-07-11 Thread Eric Brunson
Michael Klier wrote: > Dave Kuhlman wrote: > >> On Wed, Jul 11, 2007 at 11:03:18AM -0400, John Morris wrote: >> >>> I'm editing some code from Mailman and seeing: >>> >>> legend = _("%(hostname)s Mailing Lists") >>> >>> > > I am no python pro but I guess that funtction _() ist just a

Re: [Tutor] Question regarding syntax

2007-07-11 Thread Michael Klier
Dave Kuhlman wrote: > On Wed, Jul 11, 2007 at 11:03:18AM -0400, John Morris wrote: > > I'm editing some code from Mailman and seeing: > > > > legend = _("%(hostname)s Mailing Lists") > > I am no python pro but I guess that funtction _() ist just a wrapper function around gettext.gettext from the

Re: [Tutor] Question regarding syntax

2007-07-11 Thread John Morris
On 7/11/07, Dave Kuhlman <[EMAIL PROTECTED]> wrote: On Wed, Jul 11, 2007 at 11:03:18AM -0400, John Morris wrote: > I'm editing some code from Mailman and seeing: > > legend = _("%(hostname)s Mailing Lists") > The outer parentheses are a function call. The underscore is a name that has a callab

Re: [Tutor] Question regarding syntax

2007-07-11 Thread Dave Kuhlman
On Wed, Jul 11, 2007 at 11:03:18AM -0400, John Morris wrote: > I'm editing some code from Mailman and seeing: > > legend = _("%(hostname)s Mailing Lists") > The outter parenthese are a function call. The underscore is a name that has a callable as a value, I suppose. I believe that the value o

[Tutor] Question regarding syntax

2007-07-11 Thread John Morris
I'm editing some code from Mailman and seeing: legend = _("%(hostname)s Mailing Lists") Can anyone tell me what the _( means in that context? Thanks, John ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Question about code reviews

2007-07-11 Thread Tino Dai
Hi there, Do you know of any service or person that could do a code review for me? Thanks, -Tino ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

[Tutor] Question about lambda and new.instancemethod

2007-07-10 Thread Tino Dai
Hi Everybody, I have been working on a parser for myself. I want to create methods on the fly with the information that I get from a file. Here is my question: class configure: <.stuff deleted..> def parseGlobal(self,projectName,section,project): for ele

Re: [Tutor] question re: executing exe files with arguments

2007-05-20 Thread Martin Walsh
Hey Janani, Janani Krishnaswamy wrote: > Hi! > I am having trouble executing an exe file with 3 arguments within a > python script. Right now I have something like this: > > os.system(r'"1/2/3/program 1/2/3/argument1 1/2/3/argument2"') Without an error message, or traceback, this is difficult t

Re: [Tutor] question re: executing exe files with arguments

2007-05-18 Thread Luke Paireepinart
Janani Krishnaswamy wrote: > Hi! > I am having trouble executing an exe file with 3 arguments within a > python script. Right now I have something like this: > > os.system(r'"1/2/3/program 1/2/3/argument1 1/2/3/argument2"') > > I was trying it with a raw string because of the /'s within it. I'm n

<    2   3   4   5   6   7   8   9   10   >