Re: [Tutor] Python Question

2013-01-09 Thread Steve Willoughby
On 2013-1月-7, at 下午3:31, Dylan Kaufman wrote: > Greetings, > > I take Computer Science in school and for a Python program, I have: > > from winsound import Beep > The first thing I notice is "from winsound import …" Could that be a WINDOWS library which might not work on a Macintosh? > Bee

Re: [Tutor] using 'and ' and 'or' with integers

2013-01-09 Thread Brian van den Broek
On 9 January 2013 01:56, ken brockman wrote: > I was looking through some lab material from a computer course offered at UC > Berkeley and came across some examples in the form of questions on a test > about python. > 1 and 2 and 3 > answer 3 > I've goggled it till i was red in the fingers, but t

Re: [Tutor] using 'and ' and 'or' with integers

2013-01-09 Thread Alan Gauld
On 09/01/13 06:56, ken brockman wrote: 1 and 2 and 3 answer 3 I've goggled it till i was red in the fingers, but to no avail.. Could someone be kind enuff to direct me to some docs that explain this?? I've no clue what the hell is going on here.. Its to do with the way Python evaluates boole

[Tutor] pexports python27.dll > python27.def (pygraphviz 1.1 package )

2013-01-09 Thread somnath chakrabarti
I have mingw and python 2.7 in a Windows 7 box and trying to install PyGraphViz-1.1 using the following CLI utility python setup.py install build --compiler=mingw32 However, it ends up compiling error with undefined references as follows: ... build\temp.win-amd64-2.7\Release\pygraphviz\graphviz

[Tutor] Parsing and evaluating user input

2013-01-09 Thread Timo
I'm having trouble finding a safe way to parse and evaluate user input in my program. In my app, I'm using a calculation like this: (a / b) * 100 The user should be able to override this and their preference is stored in a configuration file for later use. So I now have a string with the use

Re: [Tutor] Parsing and evaluating user input

2013-01-09 Thread Oscar Benjamin
On 9 January 2013 11:20, Timo wrote: > I'm having trouble finding a safe way to parse and evaluate user input in my > program. > > In my app, I'm using a calculation like this: > (a / b) * 100 > The user should be able to override this and their preference is stored in a > configuration file for

Re: [Tutor] writing effective unittests

2013-01-09 Thread Wayne Werner
On Thu, 3 Jan 2013, Japhy Bartlett wrote: The general idea is to write tests that use your code in realistic ways and check the results.  So if you have a function that takes an input and returns a result, you write a test that passes that function an input checks the result.  If some inputs s

Re: [Tutor] pexports python27.dll > python27.def (pygraphviz 1.1 package )

2013-01-09 Thread Oscar Benjamin
Please post in plain text on this mailing list (not html). On 9 January 2013 09:38, somnath chakrabarti wrote: > > I have mingw and python 2.7 in a Windows 7 box and trying to install > PyGraphViz-1.1 using the following CLI utility > > python setup.py install build --compiler=mingw32 > > Howeve

Re: [Tutor] pexports python27.dll > python27.def (pygraphviz 1.1 package )

2013-01-09 Thread somnath chakrabarti
Actually I embedded a link to the refer site from where I have been following the procedure. I am new to Python too and have been following the book "Mining the Social Web" by Matthew Russell and thought Tutor mailing list would be the right place to post the question. Anyways will try to post in t

Re: [Tutor] Python Question

2013-01-09 Thread eryksun
On Mon, Jan 7, 2013 at 6:31 PM, Dylan Kaufman wrote: > > from winsound import Beep > > Beep(196, 1500)#G winsound.Beep wraps the Windows (win32) system call of the same name. Instead, consider using a cross-platform library such as PortAudio or PortMidi: http://sourceforge.net/apps/trac/portmedi

Re: [Tutor] Robot Radio program

2013-01-09 Thread Steven D'Aprano
On 09/01/13 12:07, Kirk Bailey wrote: Simulates an old time radio station. Place program files in the numbered folders, station identifications in the ID folder, commercials in the com folder. run from the command line. [...] Did you have a question, or where you just sharing the code with us?

Re: [Tutor] Documentation

2013-01-09 Thread Steven D'Aprano
On 07/01/13 14:48, Ed Owens wrote: [...] parser = HTMLParser(formatter.AbstractFormatter( formatter.DumbWriter(cStringIO.StringIO( HTMLParser is from htmllib. I'm having trouble finding clear documentation for what the functions that are on the 'parser =' line do and return. The thre

[Tutor] .strip question

2013-01-09 Thread richard kappler
I have a sort of a dictionary resulting from psutil.disk_usage('/') that tells me info about my hard drive, specifically: usage(total=147491323904, used=62555189248, free=77443956736, percent=42.4) I'm having a bit of a brain fudge here and can't remember how to strip out what I want. All I want

Re: [Tutor] .strip question

2013-01-09 Thread Mitya Sirenef
On Wed 09 Jan 2013 01:27:26 PM EST, richard kappler wrote: I have a sort of a dictionary resulting from psutil.disk_usage('/') that tells me info about my hard drive, specifically: usage(total=147491323904, used=62555189248, free=77443956736, percent=42.4) I'm having a bit of a brain fudge here

Re: [Tutor] .strip question

2013-01-09 Thread Peter Otten
richard kappler wrote: > I have a sort of a dictionary resulting from psutil.disk_usage('/') that > tells me info about my hard drive, specifically: > > usage(total=147491323904, used=62555189248, free=77443956736, > percent=42.4) > > I'm having a bit of a brain fudge here and can't remember how

[Tutor] run perl script files and capture results

2013-01-09 Thread T. Girowall
New to programing and need some help.   I have multiple perl script files that I would like to automate using python. Currently each one is ran individually and the output is manually examined. The perl script is ran form the command promp with arguments as follows:   c:\scripts\perl>perl plscr

[Tutor] Flow charts

2013-01-09 Thread Ed Owens
I'm working my way through Chun's book "Core Python Applications Programming" and can't get one of the examples to actually work. In trying to analyze the problem (good learning approach) I had troubles understanding the interactions between the two classes of objects. As an old FORTRAN progr

Re: [Tutor] Flow charts

2013-01-09 Thread Mitya Sirenef
On Wed 09 Jan 2013 09:26:15 PM EST, Ed Owens wrote: I'm working my way through Chun's book "Core Python Applications Programming" and can't get one of the examples to actually work. In trying to analyze the problem (good learning approach) I had troubles understanding the interactions between th

Re: [Tutor] Flow charts

2013-01-09 Thread Dave Angel
On 01/09/2013 09:26 PM, Ed Owens wrote: > I'm working my way through Chun's book "Core Python Applications > Programming" and can't get one of the examples to actually work. In > trying to analyze the problem (good learning approach) I had troubles > understanding the interactions between the two

[Tutor] How to run multiline shell command within python

2013-01-09 Thread Karim
Hello all, I want to run multiline shell command within python without using a command file but directly execute several lines of shell. I already use *subprocess.checkoutput("csh -f my_file.csh".split())* but I want to know if it is posssible to avoid making file and execute shell lines of

Re: [Tutor] run perl script files and capture results

2013-01-09 Thread eryksun
On Wed, Jan 9, 2013 at 8:14 PM, T. Girowall wrote: > > > c:\scripts\perl>perl plscript.pl -cmnd1 -cmnd2 > > cmnd1 and cmnd2 are ran on files that reside within "perl" directory. > > My objective: > 1. Run the perl script using python > 2. Capture the results from the DOS window and save it to pyth