Re: [Tutor] Process list elements as consecutive pairs

2010-03-05 Thread greg whittier
On Fri, Mar 5, 2010 at 12:56 PM, Rüdiger Wolf < rudiger.w...@throughputfocus.com> wrote: > I am trying to Process list elements as consecutive pairs into > consecutive pairs. > Any pythonic suggestions? > > listin = [1,2,3,4,5,6,7,8,9,10] > I want to process as consecutive pairs > 1,2 > 3,4 > 5,6

Re: [Tutor] merging dictionary values based on key

2009-03-12 Thread greg whittier
On Thu, Mar 12, 2009 at 4:24 PM, ski wrote: > Hello, > I have this issue, which I am unsure on how to solve. > mylist1 = {'a': 'x123', 'b':'12'} mylist2 = {'a': 'x234', 'c': 'a23'} for k in mylist2: > ...     if k in mylist1: > ...             mylist1[k] = [mylist1[k], mylist2[k]] >

Re: [Tutor] update list of dictionaries based on key

2009-03-13 Thread greg whittier
On Fri, Mar 13, 2009 at 11:09 AM, ski wrote: > Hello, > Here is what I have so far: > mylist = [{'index': 0, 'title': 'Association of British Travel Agents', 'selected': False, 'edit_row': '?edit_affiliation=0', 'affiliation': 'ABTA', 'affiliation_no': u'G3903'}, {'index': 1,

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-18 Thread greg whittier
On Wed, Mar 18, 2009 at 4:06 PM, Wayne Watson wrote: > Thanks to both above posts before this reply. > I'll forgo the VM route. It would really complicate things for the users of > the application having to deal with VM. Most are near neophytes. > Nevertheless, it looks like there may be some hope

Re: [Tutor] statistics with python

2009-03-20 Thread greg whittier
On Fri, Mar 20, 2009 at 6:45 AM, Bala subramanian wrote: > Dear python friends, > > someone kindly suggest me packages, modules and documentation resources > (especially) to > > i) plot graphs using python. > matplotlib is excellent and probably the most popular > > ii) statistical analysis

Re: [Tutor] adding dictionary values

2009-03-20 Thread greg whittier
2009/3/20 Emad Nawfal (عماد نوفل) > Hi Tutors, > I have two pickled dictionaries containing word counts from two different > corpora. I need to add the values, so that a word count is the sum of both. > If the word "man" has a count of 2 in corpus A and a count of 3 in corpus B, > then I need a n

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-20 Thread greg whittier
On Fri, Mar 20, 2009 at 1:01 PM, Wayne Watson wrote: > To be clear. The program I'm trying to execute under Win XP was compiled > on a RH Linux machine. It was not compile on a Win OS machine. It may sound > far fetched some facility might be available to do this, but somewhere in my > very, very

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-20 Thread greg whittier
On Fri, Mar 20, 2009 at 1:41 PM, Wayne Watson wrote: > Yes, I'm sure I'll need help. I just posted a message minutes before yours > mentioning I'm willing to try Cygwin. The C program, wolf, is the public > domain If trying to compile the program under Win is what you had in mind, > then I can s

Re: [Tutor] plotting with python

2009-03-27 Thread greg whittier
matplotlib and pylab are two APIs to the same library. Using matplotlib is a more object-oriented, pythonic API. pylab is modeled after the Matlab plotting functions to make it easier for those coming from that environment. There's a matplotlib mailing list and you can often figure out what you

Re: [Tutor] Adding key, value to Dictionary

2009-03-27 Thread greg whittier
On Fri, Mar 27, 2009 at 1:31 PM, David wrote: > But I can not get this to update after the first time it is ran. > > def get_todo(): >    todo = {} This set todo to an empty dictionary each time you execute get_todo. >    key = raw_input('Enter Todo Title: ') >    todo[key] = key >    print '\n'

Re: [Tutor] Unknown reason for error.

2009-09-24 Thread greg whittier
On Thu, Sep 24, 2009 at 2:15 PM, Corey Richardson wrote: > Hello, python tutors, its Corey. > Anyway, I'm getting a syntax error for an unknown reason. Here is my > code... > name = raw_input("What is your name?") > print "Hello, ", name > wellness = raw_input("How are you?") > if wellness !=

Re: [Tutor] Help or Advice on MySQL, Python and test data storage

2009-10-14 Thread greg whittier
On Thu, Oct 8, 2009 at 4:29 AM, David Jamieson wrote: > Hi All, > looking for some advice on using Python with MySQL for test data > storage. > While not a relational database, you might also look at http://www.pytables.org. It provides a python interface for writing to and reading from hdf5 fil

Re: [Tutor] Problems with Gauge Bar.

2008-08-10 Thread greg whittier
On Sun, Aug 10, 2008 at 6:49 AM, Olrik Lenstra <[EMAIL PROTECTED]> wrote: > The program runs fine and works perfectly as the code is right now, But > while I'm asking for the bar, can I ask for some advice on the following bit > of code too? > > <<< > ##-

Re: [Tutor] Problems with Gauge Bar.

2008-08-10 Thread greg whittier
On Sun, Aug 10, 2008 at 10:38 AM, Olrik Lenstra <[EMAIL PROTECTED]> wrote: > That bit of code doesn't make a lot of sense to me so far. > I don't see how that could "X" out a public address. > > (I do appreciate the help!) > > Regards, > Olrik > r = re.compile(r"(\d+)\.(\d+)\.\d+\.\d+") m = re.sea

Re: [Tutor] How Compute # of Days between Two Dates?

2008-09-01 Thread greg whittier
On Mon, Sep 1, 2008 at 10:17 AM, Wayne Watson <[EMAIL PROTECTED]> wrote: > That's the question in Subject. For example, the difference between > 08/29/2008 and 09/03/2008 is +5. The difference between 02/28/2008 and > 03/03/2008 is 4, leap year--extra day in Feb. I'm really only interested in > yea

Re: [Tutor] Message 'list' object has no attribute 'strptime ?

2008-09-04 Thread greg whittier
On Thu, Sep 4, 2008 at 2:00 PM, Wayne Watson <[EMAIL PROTECTED]>wrote: > The line > x = time.strptime(fmt_time, "%H %M %S") > with fmt_time = "11 12 40" > in function produces the msg: > Traceback (most recent call last): > File > "C:\Sandia_Meteors\Improved_Sentinel\Sentinel_Playground\Uti

Re: [Tutor] Message 'list' object has no attribute 'strptime ?

2008-09-04 Thread greg whittier
On Thu, Sep 4, 2008 at 4:05 PM, Wayne Watson <[EMAIL PROTECTED]>wrote: > Further info. If I put > y = time.strptime("11 01 05", "%H %M %S") > both in the function and in the main body. Only the line above in the > function produces an error message. > > Here's a simple program that creates th

Re: [Tutor] Formating from hhmms to hh:mm:ss

2008-09-07 Thread greg whittier
I'm not clear on exactly what you're looking to do, but I think you want the strftime and strptime methods. See http://docs.python.org/lib/datetime-datetime.html On Sun, Sep 7, 2008 at 11:24 AM, Wayne Watson <[EMAIL PROTECTED]>wrote: > I've been writing various functions with datetime to change

Re: [Tutor] Formating from hhmms to hh:mm:ss

2008-09-07 Thread greg whittier
Is this an actual cut and paste of your code? The problem seems to be that you're getting a time.struct_time object instead of a datetime object. See below On Sun, Sep 7, 2008 at 12:52 PM, Wayne Watson <[EMAIL PROTECTED]>wrote: > Yes, that's correct., but that reference isn't doing it for me p

Re: [Tutor] Formating from hhmms to hh:mm:ss

2008-09-07 Thread greg whittier
On Sun, Sep 7, 2008 at 1:36 PM, Wayne Watson <[EMAIL PROTECTED]>wrote: > Yes, cut and paste directly from the code. Positively a import as seen. > Here's the full set of code: > > # The effect of adding seconds to date-time to see if day gets changed > import datetime > dt1 = datetime.datetime(20

Re: [Tutor] Sort Output

2008-09-17 Thread greg whittier
On Wed, Sep 17, 2008 at 3:30 PM, Wayne Watson <[EMAIL PROTECTED]>wrote: > I'm using Python 2.4 in Win XP. I was surprised to find the result below. > > >>> a =[4,2,5,8] > >>> b = a > >>> a.sort() > >>> a > [2, 4, 5, 8] > >>> b > [2, 4, 5, 8] > > b no longer has the same value as it began. Apparen

Re: [Tutor] deltatime difficulty

2008-09-18 Thread greg whittier
On Thu, Sep 18, 2008 at 8:38 PM, Wayne Watson <[EMAIL PROTECTED]>wrote: > What's the problem here. It seems right to me. line 9 is diff =... > > import time > from datetime import datetime > > You've imported the datetime class from the datetime module. > > def adjust_ftime(afilename, sec): >

Re: [Tutor] school physics/math courses

2008-10-16 Thread greg whittier
On Thu, Oct 16, 2008 at 7:15 AM, roberto <[EMAIL PROTECTED]> wrote: > hello > (i am rather new in python ...) > > i am about to start a course of physics and math for students aged > 14-17 (high school) > and i am deeply interested in the possibilty of teaching fundamental > concepts of these subj

Re: [Tutor] Running a script from another folder

2008-11-12 Thread greg whittier
> it looks like you're on linux - so at the beginning of your script put > #!/usr/bin/env python (I believe) and then chmod +x myscript.py > > then you can call it from the command line. > You'll also need to make sure ~myID/bin is in your PATH. ___ Tuto

[Tutor] experience/opinions with deploying python GUI app to Linux, Win32, and Mac OS X

2008-11-12 Thread greg whittier
Hi gang, I know this is probably like asking whether vi or emacs is better, but I'm looking for the best cross-platform (linux, windows, mac os x) user interface toolkit. Since the users won't be programmers, I'd like it to feel as much like a native app as possible in terms of installation. It

Re: [Tutor] experience/opinions with deploying python GUI app to Linux, Win32, and Mac OS X

2008-11-13 Thread greg whittier
Thanks for all the great replies! You've reaffirmed my #1 and #2 seeds -- wxpython and a web app. I haven't really found any show stoppers for wxpython, but I guess I was unnecessarily suspicious. dabodev.com looks like it targets my problem so that's something I'll definitely look at. I had one

Re: [Tutor] "Pointer" to a function? Storing a function as an object property? Passing arguments by value/by reference?

2009-01-16 Thread greg whittier
On Fri, Jan 16, 2009 at 7:51 AM, Vicent wrote: > > That "problem" has to contain, somehow, a property or element called > "function" which, in fact, I would like it to be a function, or a "pointer" > to a function. In python, the name of a function is just a pointer to it. Try this >>> def fo

Re: [Tutor] Translating FORTRAN (77?) to Python?

2009-01-16 Thread greg whittier
There's an absolutely incredible project call f2py http://cens.ioc.ee/projects/f2py2e/ that I've used before. It doesn't translate the code, but wraps it (which is actually better) and lets you import your library as a module. It even generates docstrings so you can see how to call the functions.

[Tutor] __builtins__

2009-02-09 Thread greg whittier
I'm trying to use sparkplot from sparkplot.org as a module. It's normally run from the command line and acts on an input file. I'd like to use it as a module though to render png's for a web application. Anyway, if I try "import sparkplot" from the interpreter, I get >>> import sparkplot Traceb