Re: [Tutor] Fwd: Executing a command from a specific directory

2009-09-16 Thread Sander Sweers
On Wed, 2009-09-16 at 18:03 +0530, Ansuman Dash wrote: > if "Request timed out.." not in a: > print("Ping is not successful.") > pLogger.info("Ping is not successful.") This will check for the string "Request timed out.." is NOT in a. Now when the ping i

Re: [Tutor] Fwd: Executing a command from a specific directory

2009-09-16 Thread Ansuman Dash
Hi, Thank you very much for the quick response. Code is working fine. Now I am trying to validate that the command is executed successfully. I have written following script to validate the log file which is created after running the command. =

Re: [Tutor] Fwd: Executing a command from a specific directory

2009-09-16 Thread Patrick Sabin
Ansuman Dash schrieb: Hello Everybody, In Python scripting, how can I execute a command (which can be run from spcific directory) and then retrieve the result (after executing the command it give the command is executed successfull or not), so that I can validate it. Thanks, AD import

Re: [Tutor] Fwd: The why

2009-07-16 Thread Kent Johnson
> From: chris Hynes > Date: 2009/7/15 > Subject: The why > To: roadier...@googlemail.com > > > Well, I'm trying to create an interactive program, let's say I'm > running the program, I ask the user to give the array a name, I then > do some computations and store the results in that array. While I

Re: [Tutor] Fwd: The why

2009-07-16 Thread Luke Paireepinart
You need to read what dictionaries are. Essentially, any time you think "oh I need to keep separate variables for these values, but I won't know what their names are until runtime!" the correct answer is to not try to manipulate them into variables, but to use them as dictionary keys, or organize t

Re: [Tutor] Fwd: thesaurus

2009-07-09 Thread Alan Gauld
"Angus Rodgers" wrote parsing these two sentences: Time flies like an arrow. Fruit flies like a banana. Or the translation program that translated the expression Out of sight, out of mind from English to Russian and back with the result: Invisible, lunatic Alan G.

Re: [Tutor] Fwd: thesaurus

2009-07-09 Thread Angus Rodgers
>Date: Thu, 9 Jul 2009 04:12:55 +0100 >From: Rich Lovely >Message-ID: > > >Natural language parsers are one of the hardest things to create. I think the most famous illustration of this is the problem of parsing these two sentences: Time flies like an arrow. Fruit flies like a banana. --

Re: [Tutor] Fwd: thesaurus

2009-07-08 Thread Pete Froslie
oops.. I just realized I attached the wrong example for the API-- it was off by number, this one works: print urllib.urlopen(' http://words.bighugelabs.com/api/2/e413f24701aa30b8d441ca43a64317be/moving/').read( ) The example makes sense to me and I can see how it is difficult to figure out a natu

Re: [Tutor] Fwd: thesaurus

2009-07-08 Thread Rich Lovely
2009/7/9 Pete Froslie : > I see.. that makes sense. Kind of new with python -- sorry for that. > > after printing using this: > > print > urllib.urlopen('http://words.bighugelabs.com/api/2/e413f24801aa30b8d441ca43a64317be/moving/').read() > > I'm getting a format like this returned: > > adjective|s

Re: [Tutor] Fwd: thesaurus

2009-07-08 Thread Pete Froslie
I see.. that makes sense. Kind of new with python -- sorry for that. after printing using this: print urllib.urlopen(' http://words.bighugelabs.com/api/2/e413f24801aa30b8d441ca43a64317be/moving/').read( ) I'm getting a format like this returned: adjective|sim|streaming adjective|sim|swirling ad

Re: [Tutor] Fwd: thesaurus

2009-07-08 Thread Rich Lovely
2009/7/9 Pete Froslie : > No problem, thanks for taking the time. > > I'm actually trying to resolve this error now: > >    buff.append(" ".join(lookup(Word) for Word in line.split())) > NameError: global name 'lookup' is not defined > > ..also assume I need to change 'Word' to something that check

Re: [Tutor] Fwd: thesaurus

2009-07-08 Thread Pete Froslie
No problem, thanks for taking the time. I'm actually trying to resolve this error now: buff.append(" ".join(lookup(Word) for Word in line.split())) NameError: global name 'lookup' is not defined ..also assume I need to change 'Word' to something that checks the next word in the text file and

Re: [Tutor] Fwd: thesaurus

2009-07-08 Thread Rich Lovely
2009/7/9 Pete Froslie : > Great Richard, thanks.. > > I'm getting an error as follows: > > from __future__ import with_statement > SyntaxError: from __future__ imports must occur at the beginning of the file > > I don't think this is the issue in need of rework and have tried a few quick > reworks.

Re: [Tutor] Fwd: thesaurus

2009-07-08 Thread Pete Froslie
Great Richard, thanks.. I'm getting an error as follows: from __future__ import with_statement SyntaxError: from __future__ imports must occur at the beginning of the file I don't think this is the issue in need of rework and have tried a few quick reworks.. I'll read up a bit on 'with' cheers

Re: [Tutor] Fwd: thesaurus

2009-07-08 Thread Rich Lovely
2009/7/9 Pete Froslie : > > > -- Forwarded message -- > From: Pete Froslie > Date: Wed, Jul 8, 2009 at 8:53 PM > Subject: Re: [Tutor] thesaurus > To: Robert Berman > > > Thanks Robert, > > I will try this out.. at the moment I'm playing with an API from > 'http://words.bighugelabs

Re: [Tutor] Fwd: Problems with parameter queries

2009-06-25 Thread Eduardo Vieira
On Wed, Jun 24, 2009 at 6:16 PM, Richard Lovely wrote: > (oops... forgot to reply-all) > > > -- Forwarded message -- > From: Richard Lovely > Date: 2009/6/25 > Subject: Re: [Tutor] Problems with parameter queries > To: Eduardo Vieira > > > 2009/6/24 Eduardo Vieira : >> Hello, I am

Re: [Tutor] [Fwd: Re: What is this kind of loop called]

2009-06-07 Thread Luke Paireepinart
def get(numbers): print 'Calling ', numbers sleep(1) print 'Connected ' sleep(1) def call_numbers(): for i in range(9549355543, 9549355560): numbers = i get(numbers) call_numbers() Is there a technical name for a loop like this? For loop? That is what I c

Re: [Tutor] [Fwd: Re: Find files without __doc__ strings]

2009-05-18 Thread Lie Ryan
David wrote: Subject: Re: [Tutor] Find files without __doc__ strings From: David Date: Mon, 18 May 2009 14:02:38 -0400 CC: tutor@python.org Lie Ryan wrote: David wrote: spir wrote: Le Sat, 16 May 2009 21:46:02 -0400

Re: [Tutor] [Fwd: Re: simply moving files]]

2009-05-12 Thread sli1que
Dave Slashes in linux indicate a directory path. You use them when trying to specify paths. You can also use them to specify a path to a file. Sent from my Verizon Wireless BlackBerry -Original Message- From: David Date: Tue, 12 May 2009 20:07:10 To: Subject: [Tutor] [Fwd: Re: simply

Re: [Tutor] Fwd: Defining "bit" type

2009-01-24 Thread Kent Johnson
On Sat, Jan 24, 2009 at 10:36 AM, Vicent wrote: > But this is not nice: > type(a) > a > True a = 0 type(a) > > > > I mean, being "a" a boolean variable, it works as if it was a number, but > every time I want to update the value of "a", I must put "False" for 0 and > "True"

Re: [Tutor] Fwd: Class Extend Help

2008-12-28 Thread Omer
Thx for help, extreme lack of free time lately, will look into it. [Wouldn't've noticed myself that urlopen is not a class.] On Tue, Dec 23, 2008 at 6:03 PM, Richard Lovely wrote: > OK, going on Kent's post: > > from urllib import urlopen > > class fetch(object): >def __init__(self, *args):

Re: [Tutor] Fwd: Class Extend Help

2008-12-23 Thread Richard Lovely
OK, going on Kent's post: from urllib import urlopen class fetch(object): def __init__(self, *args): self.response = urlopen(*args) self.content = self.response.read() I forgot urlopen was a function. It made sense in my head for it to be a class, instead of _returning_ a c

Re: [Tutor] Fwd: Class Extend Help

2008-12-23 Thread Kent Johnson
On Tue, Dec 23, 2008 at 9:31 AM, Omer wrote: from urllib import urlopen class fetch(urlopen): > ... def __init__(self,*args): > ... urlopen.__init__(self, *args) > ... self.content = self.read() > ... > > Traceback (most recent call last): > File "", line 1, in >

Re: [Tutor] [Fwd: Re: reading output from a c executable.]

2008-12-11 Thread Steve Willoughby
With the amount of information provided so far, I'd say you need to step back and question your initial assumptions. Python shouldn't have a great deal of trouble reading variable-length binary data blocks, and the overhead of doing that is probably a lot less than it would be to have another

Re: [Tutor] Fwd: how to see a number as two bytes

2008-10-20 Thread Steve Willoughby
> > high, low = ((num % 2**16) >> 8, num % 2**8) or something thereabouts. My take would be something like high, low = (num >> 8) & 0xff , num & 0xff In case you want another option. This is probably more efficient since you're not raising to powers or taking the modulus, although for all I kn

Re: [Tutor] Fwd: how to see a number as two bytes

2008-10-20 Thread Luke Paireepinart
I'm not sure if those values are correct; I can check later tonight, but I'm doing some statechart diagrams for class right now. They sound reasonable but I can't be sure. On Mon, Oct 20, 2008 at 11:20 AM, shawn bright <[EMAIL PROTECTED]> wrote: > jeez, i screwed up, i ment num = 600, not 6 > th

Re: [Tutor] Fwd: how to see a number as two bytes

2008-10-20 Thread Luke Paireepinart
No, I'm not sure what you mean. Given this number 100101010101101011 the operation will slice off bits on the left with the % 2**16 so that we only have 16 bits, 0101010101101011 then it will shift this value to the right so that we only have the highest 8 bits 01010101 that will be stored in hig

Re: [Tutor] Fwd: how to see a number as two bytes

2008-10-20 Thread shawn bright
thanks, Luke, got me started anyway. shawn On Mon, Oct 20, 2008 at 11:23 AM, Luke Paireepinart <[EMAIL PROTECTED]> wrote: > I'm not sure if those values are correct; I can check later tonight, > but I'm doing some statechart diagrams for class right now. They > sound reasonable but I can't be su

Re: [Tutor] Fwd: how to see a number as two bytes

2008-10-20 Thread shawn bright
jeez, i screwed up, i ment num = 600, not 6 thanks On Mon, Oct 20, 2008 at 11:16 AM, Luke Paireepinart <[EMAIL PROTECTED]> wrote: > No, I'm not sure what you mean. > Given this number > > 100101010101101011 > > the operation will slice off bits on the left with the % 2**16 so that > we only have 1

Re: [Tutor] Fwd: how to see a number as two bytes

2008-10-20 Thread shawn bright
so using this, if num ==6, then i should get 2 and 88 ? thanks, just checking to make sure i get what you wrote. shawn On Mon, Oct 20, 2008 at 11:00 AM, Luke Paireepinart <[EMAIL PROTECTED]> wrote: > -- Forwarded message -- > From: Luke Paireepinart <[EMAIL PROTECTED]> > Date: Mon,

Re: [Tutor] Fwd: Looking at a String as a Struct?

2008-09-11 Thread Wayne Watson
Title: Signature.html I've done far worse by hitting the wrong key! ;-) I see a post above gets into the class idea. Jaggo wrote: Silly google sent in the middle of my editing. Good thing it only sent to you then. Please, ignore these 2 messages. Sorry 'bout the mess. -- Forwa

Re: [Tutor] Fwd: "Analyzing" music with Python

2008-09-05 Thread Timo
>if pitch == csharp: >runmyprogram(now) Yep, that is something what I'm looking for. And maybe with some other thing than pitch too (don't know what you can get from a sound file). But I looked at most of the examples of the modules and couldn't find anything like this. W W schreef:

Re: [Tutor] Fwd: Need help with Factorial algorithm using Python

2008-09-04 Thread Chris Fuller
The point of a lot of these challenges is to be smart with your math as well as your code. A brute force approach isn't going to work very well, especially in this case. An integer with 7^20 trailing zeros isn't even going to fit in your RAM. An observation: every trailing zero implies a fac

Re: [Tutor] Fwd: Problem Euler 26

2008-07-01 Thread W W
Just a tidbit: A neat function my friend came up with last year to figure out the length of a whole number (now converted to python for your viewing pleasure): from math import log10 as log from math import floor def findNumberLength(number): number = float(number) x = log(number) x

Re: [Tutor] [Fwd: Re: Intercepting methods calls]

2008-06-06 Thread Marilyn Davis
On Fri, June 6, 2008 3:37 pm, Andreas Kostyrka wrote: > On Friday 06 June 2008 18:19:23 you wrote: > >> On Thu, June 5, 2008 9:39 am, Andreas Kostyrka wrote: >> >>> On Thursday 05 June 2008 00:18:55 Marilyn Davis wrote: >>> You listed __init__ and I'm not sure I know what you mean. >>> >

Re: [Tutor] [Fwd: Re: Intercepting methods calls]

2008-06-06 Thread Andreas Kostyrka
On Friday 06 June 2008 18:19:23 you wrote: > On Thu, June 5, 2008 9:39 am, Andreas Kostyrka wrote: > > On Thursday 05 June 2008 00:18:55 Marilyn Davis wrote: > >> You listed __init__ and I'm not sure I know what you mean. > > > > Well, __init__ can assign attributes to the instance that are callabl

Re: [Tutor] [Fwd: Re: Intercepting methods calls]

2008-06-05 Thread Andreas Kostyrka
On Thursday 05 June 2008 00:18:55 Marilyn Davis wrote: > > You listed __init__ and I'm not sure I know what you mean. > Well, __init__ can assign attributes to the instance that are callable. Andreas signature.asc Description: This is a digitally signed message part. ___

Re: [Tutor] Fwd: Running shell command

2008-05-30 Thread Ricardo Dueñas Parada
I´m running Fedora 8, in this case the command is su -c 'command'. I also think it's better to allow a specific user to use smartctl. I will do that. Thank´s, it was really helpfull. _Ricardo 2008/5/30 W W <[EMAIL PROTECTED]>: > Curse my forgetting to reply to all! > > -- Forwarded m

Re: [Tutor] Fwd: syntax question

2008-05-23 Thread Kent Johnson
On Fri, May 23, 2008 at 2:25 PM, Moishy Gluck <[EMAIL PROTECTED]> wrote: > I came in python around 2.5. So I've been using "Boolean and 1 or 2". For Python 2.5 you should use the new syntax 1 if Boolean or 2 It doesn't have the problems of the unofficial syntax you quote. Kent

Re: [Tutor] Fwd: listing classes

2008-05-22 Thread W W
I don't know if this is the best solution, but what I usually do is create a list that matches the key: mydict = {} mylist = [] for x in range(1, 10): key = raw_input("Enter the key: ") mydict[key] = value mylist.append(key) You just have to change it to read from a file/hard code all

Re: [Tutor] Fwd: syntax question

2008-05-21 Thread Kent Johnson
On Wed, May 21, 2008 at 12:00 PM, Moishy Gluck <[EMAIL PROTECTED]> wrote: > You appear to be referring to list comprehension. No, it is not a list comp. See my separate reply. Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/

Re: [Tutor] Fwd: Simple copy script

2008-04-14 Thread Andreas Kostyrka
line.strip() for line in file: => line will contain '\n' at the end of the string. Andreas Am Montag, den 14.04.2008, 00:08 -0700 schrieb Que Prime: > > This is what I came up with after writing it out and reading the > corresponding functions. I feel I'm close but something is still > awry. >

Re: [Tutor] Fwd: my first project: a multiplication trainer

2008-03-15 Thread Kent Johnson
Marc Tompkins wrote: > Myself, I have a horrible time writing pseudocode without slipping into > real-code syntax Me too - often Python is more concise, precise and expressive than English for expressing an algorithm. > while len(possibleQuestions) > 0: could be simply while possibleQuest

Re: [Tutor] [Fwd: PyWeek 6 is coming!]

2008-02-02 Thread bhaaluu
Would you consider a python-Tutor team member who: 1. Is new to Python? 2. Never worked with a programming team before? 3. Doesn't have much gaming experience? 4. Doesn't have a recent version of MS-Windows (has Mac OS X or GNU/Linux)? 5. May not be running the latest and greatest version of Pytho

Re: [Tutor] Fwd: Permission Report

2007-10-10 Thread Stephen Nelson-Smith
On 10/10/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > Stephen Nelson-Smith wrote: > > But if I want to run the same procedure on a remote host, and store > > the results in a dictionary so they can be compared, what would I do? > > What kind of access do you have to the remote host? If you have >

Re: [Tutor] Fwd: Permission Report

2007-10-09 Thread Kent Johnson
Stephen Nelson-Smith wrote: > But if I want to run the same procedure on a remote host, and store > the results in a dictionary so they can be compared, what would I do? What kind of access do you have to the remote host? If you have filesystem access you can use the same program running locally.

Re: [Tutor] [Fwd: Re: python problem - help!!]

2007-09-24 Thread bhaaluu
> print 'testvar: %.2f' % testvar > Output: > testvar: 10.0123 Should be: print 'testvar: %.4f' % testvar Output: testvar: 10.0123 -- bhaaluu at gmail dot com On 9/24/07, bhaaluu <[EMAIL PROTECTED]> wrote: > Greetings, > > I ran the code sample you sent and found a couple of errors > that woul

Re: [Tutor] [Fwd: Re: python problem - help!!]

2007-09-24 Thread bhaaluu
Greetings, I ran the code sample you sent and found a couple of errors that wouldn't let the code run. The first error has to do with variable assignment. When you assign a variable, it is usually on the left and what you want to assign to it is on the right. See Lines 25,29. The second error ha

Re: [Tutor] [Fwd: Re: python problem - help!!]

2007-09-23 Thread Chris
It's not a homework problem it is a practice problem to figure out how to code, to be able to do the assignments... Chris wrote: > If I sent you the problem can you build it so I know what it is suppose to > look like? I've spend too much time it, and made it worse...all I know is > that it does

Re: [Tutor] [Fwd: Re: n.isalnum() is failing]]

2007-07-03 Thread Alan Gauld
"Terry" <[EMAIL PROTECTED]> wrote > I was using the "t1 == int(t1)" type compare, that I > learned in BASIC about 25 years ago, to discover > a remainder or no. What a pity. Even the most elementary BASIC has always had the MOD operator for finding remainders. and a \ operator for integer d

Re: [Tutor] [Fwd: Re: trouble with "if"]

2007-06-02 Thread Luke Paireepinart
Adam Urbas wrote: > Sorry about all that trouble for you Alan, after I posted that, I > reformatted my code a bit and updated it to do the defining and then > the calling, like you said. The only problem I had, and I was > probably doing something wrong, was that I would do: > > choice() > if choi

Re: [Tutor] [Fwd: Re: trouble with "if"]

2007-06-01 Thread Adam Urbas
Sorry about all that trouble for you Alan, after I posted that, I reformatted my code a bit and updated it to do the defining and then the calling, like you said. The only problem I had, and I was probably doing something wrong, was that I would do: choice() if choice in["1","circle"]: circle

Re: [Tutor] [Fwd: Re: trouble with "if"]

2007-05-30 Thread Alan Gauld
Hi Adam > flaw in my loop. It is not infinite. In fact you don't have a loop, your program is really just a simple sequence. #Welcome screen: def welcome(): print "Welcome to the Area Calculation Program." print welcome() AG:Since you only call this once there is no point in putting A

Re: [Tutor] [Fwd: Re: trouble with "if"]

2007-05-30 Thread Adam Urbas
Once again this is my latest version. I know of several problems, such as the previously posted infinite looping problem. Also, if sends you to the wrong place sometimes. Ex: a second ago, I pressed 4 to exit (which does not work either) and it took me to triangle. I'm not sure how to end the

Re: [Tutor] [Fwd: Re: trouble with "if"]

2007-05-30 Thread Adam Urbas
Ok I forgot to put some things on the previous one. I discovered a flaw in my loop. It is not infinite. If you select circle, radius, enter the radius, circle, radius, enter the radius, then the program stops. I want it to be able to keep going as many times as needed, infinitely. So that the

Re: [Tutor] [Fwd: Re: trouble with "if"]

2007-05-30 Thread Adam Urbas
I think I may have figured it out. I just switched some things around. On 5/30/07, Adam Urbas <[EMAIL PROTECTED]> wrote: I can't seem to get the type with the parameters to work. I can get def answer(): to work, but not def answer(my_first_parameter,my_second_parameter):. I'm not too concerne

Re: [Tutor] [Fwd: Re: trouble with "if"]

2007-05-30 Thread Adam Urbas
I can't seem to get the type with the parameters to work. I can get def answer(): to work, but not def answer(my_first_parameter,my_second_parameter):. I'm not too concerned, as I haven't yet needed to use that. But, when I use the parameter type, it runs without error messages, but doesn't disp

Re: [Tutor] [Fwd: Re: trouble with "if"]

2007-05-30 Thread Brian van den Broek
Adam Urbas said unto the world upon 05/30/2007 11:01 AM: > I can't exactly show you the error message anymore, because the program is > now screwed up in so many ways that I can't even get it to do the things it > used to. > > It says things like ERROR: Inconsistent indentation detected! > 1) Your

Re: [Tutor] [Fwd: Re: trouble with "if"]

2007-05-30 Thread Adam Urbas
Ahahahahaha... I have figured these out beyond comprehension and power. Wahhaha. It feels good to get something to work correctly. Thanks much Andre. I don't quite understand the putting of things inside the parentheses, but I've discovered that I don't really need to, because def text(): works

Re: [Tutor] [Fwd: Re: trouble with "if"]

2007-05-30 Thread Adam Urbas
I can't exactly show you the error message anymore, because the program is now screwed up in so many ways that I can't even get it to do the things it used to. It says things like ERROR: Inconsistent indentation detected! 1) Your indentation is outright incorrect (easy to fix), OR 2) Your indenta

Re: [Tutor] [Fwd: Re: trouble with "if"]

2007-05-30 Thread Andre Engels
2007/5/30, Brian van den Broek <[EMAIL PROTECTED]>: > Another fwd, folks. > > Brian vdB > > Original Message > Subject: Re: [Tutor] trouble with "if" > Date: Tue, 29 May 2007 23:28:46 -0500 > From: Adam Urbas <[EMAIL PROTECTED]> > To: Brian van den Broek <[EMAIL PROTECTED]> > Refe

Re: [Tutor] Fwd: iterating

2007-04-30 Thread Kent Johnson
Cecilia Alm wrote: > 2007/4/30, Kent Johnson <[EMAIL PROTECTED]>: > . Also if you are adding or deleting from the dict >> during the iteration then dict.keys() is safer because the list of keys >> is created before the add and delete. > > Thanks for the response; by adding and deleting, I assume y

Re: [Tutor] Fwd: Reg http request object

2007-01-05 Thread Kent Johnson
Anil, I'm also confused about what you are trying to do. Are you writing a client application that talks to a web application? A web application that talks to a different web application? A new part of an existing web application? What are you using web.py for? What does facebook have to do wi

Re: [Tutor] [Fwd: Re: Problems writing data into a file]

2006-12-18 Thread Andreas Kostyrka
* Stefan Heyne <[EMAIL PROTECTED]> [061218 09:51]: > OK, thanksno I get the data into a file output..but I still am stuck > with the formatting... > 1) there are brackets around the data that are due to the necessary (??) > conversion to a string > 2) I cannot figure out how to insert a newli

Re: [Tutor] Fwd: Self, Scopes and my unbelievable muddleheadedness.

2006-10-26 Thread Luke Paireepinart
doug shawhan wrote: > [lots of stuff!] You seem to have a penchant for choosing entertaining, albeit confusing, words to explain what you're thinking. I have a similar inclination; however, I'll attempt to avoid this so that my explanation will make more sense :) Now we begin. First, an example

Re: [Tutor] Fwd: Help with basic user-data file

2006-10-12 Thread Kent Johnson
> From: Asrarahmed Kadri <[EMAIL PROTECTED]> > Date: Oct 12, 2006 9:17 AM > Subject: Re: [Tutor] Help with basic user-data file > To: Rob Andrews <[EMAIL PROTECTED]> > > > Thanks. > Can you please also tell me how to check the existence of a file using > python builtin functions. If path is a st

Re: [Tutor] [Fwd: Re: from string to variable name]

2006-10-05 Thread Kent Johnson
Python wrote: > On Thu, 2006-10-05 at 09:17 -0500, Luke Paireepinart wrote: > (actually from Frank) >>> I have a parameterized string template, I publish it using >>> >>> print mytemplate % locals() > Original post asked to create variable in local namespace from string. >> so I want to assign a

Re: [Tutor] [Fwd: Re: from string to variable name]

2006-10-05 Thread Python
On Thu, 2006-10-05 at 09:17 -0500, Luke Paireepinart wrote: (actually from Frank) > > I have a parameterized string template, I publish it using > > > > print mytemplate % locals() Original post asked to create variable in local namespace from string. > so I want to assign a value to a variable w

Re: [Tutor] [Fwd: Re: database web app, what tool?]

2006-10-04 Thread Dave Kuhlman
On Tue, Oct 03, 2006 at 05:05:59PM +1300, Liam Clarke wrote: > > > Original Message > Subject: Re: [Tutor] database web app, what tool? > Date: Mon, 02 Oct 2006 09:33:28 +0100 > From: [EMAIL PROTECTED] > To: Liam Clarke <[EMAIL PROTECTED]> > References:

Re: [Tutor] [Fwd: guess]

2006-10-04 Thread Andre Engels
2006/10/4, Kent Johnson <[EMAIL PROTECTED]>: > hey i added another guessing feature that shuld guess the number in the > most > effective way > but i keep getting into endless loops thought you might want it > any help with the loops would be great What's the value of number? Where is it defined

Re: [Tutor] [Fwd: Re: database web app, what tool?]

2006-10-03 Thread Mike Hansen
> To: Liam Clarke <[EMAIL PROTECTED]> > References: <[EMAIL PROTECTED]> > <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> > > > > Thank you Liam, > > > Our web server is IIS, but it would be no problem to use > another one for this > particular purpose. > > I'v been looking for information on h

Re: [Tutor] [Fwd: [Fwd: self-modification]]

2006-08-24 Thread Zsiros Levente
Alan Gauld wrote: > >> Why does the python shell says this: >> > print exec.__doc__ >> File "", line 1 >>print exec.__doc__ >> ^ >> SyntaxError: invalid syntax > > > exec, like print, is a statement, or command, not a function. > > You get the same response if you try > >

Re: [Tutor] [Fwd: [Fwd: self-modification]]

2006-08-22 Thread Alan Gauld
> Why does the python shell says this: > print exec.__doc__ > File "", line 1 >print exec.__doc__ > ^ > SyntaxError: invalid syntax exec, like print, is a statement, or command, not a function. You get the same response if you try >>> print print.__doc__ or >>> help(pr

Re: [Tutor] [Fwd: [Fwd: self-modification]]

2006-08-22 Thread Kent Johnson
Zsiros Levente wrote: > Why does the python shell says this: > > print exec.__doc__ > File "", line 1 > print exec.__doc__ > ^ > SyntaxError: invalid syntax > > > While it works with "eval". exec is a statement that is interpreted by the compiler and compil

Re: [Tutor] [Fwd: [Fwd: self-modification]]

2006-08-22 Thread Zsiros Levente
Why does the python shell says this: >>> print exec.__doc__ File "", line 1 print exec.__doc__ ^ SyntaxError: invalid syntax While it works with "eval". Anyway, I'm quite impressed with the resposiveness of this list. Thanks a lot. Zsiros Levente wrote: > > > Sorry, the s

Re: [Tutor] [Fwd: [Fwd: self-modification]]

2006-08-21 Thread Kent Johnson
Zsiros Levente wrote: > Sorry, the source was for my tkinter question. I'm a bit disorganized > today. > > The problematic part is the 11. line, where I have to convert the item > selected from the list to an object, or something like that. At the > moment it only applies to a string object, but

Re: [Tutor] [Fwd: self-modification]

2006-08-21 Thread Alan Gauld
> I forgot the most important thing: the attachment. OK, Here is my annotated version. not sure if it will solve your problem though... # #!/usr/bin/python # In this program I wanted to write the event > on my own, combining , and from Tkinter import * def handl

Re: [Tutor] Fwd: How do you create built-in objects (dicts, lists, etc) without specifying {}, [], etc...

2006-05-19 Thread Kent Johnson
Bill Carson wrote: > Do you know how to create instances of dictionaries, lists, integers, > longs, etc without having to specify it in code... > > Instead of specifying: > a={"bla":1} > or ... > a=[1,2,3] > > Is there another way?? I'm not really sure what you are looking

Re: [Tutor] Fwd: eclipseplugin for python

2006-05-11 Thread Don Taylor
shivayogi kumbar wrote: > > > I downloaded python plugin for eclipse by directly downloading zip file > and extracting under eclipse folder; because it could not update via > PROXY. It was suggested to update plugins from eclipse IDE only. I am > unable to use that plugin(Python) in eclipse.

Re: [Tutor] [Fwd: Re: Indoor ultimate]

2006-03-14 Thread John Fouhy
On 15/03/06, Sam B <[EMAIL PROTECTED]> wrote: > I'm keen! > > what shoe type do you reccomend? Non-marking cross trainers will do. If you want to spend more money, go into shoe clinic and tell them you want shoes for playing indoor ultimate. I ended up with a pair of Adidas handball shoes. Expe

Re: [Tutor] [Fwd: Re: Indoor ultimate]

2006-03-14 Thread John Fouhy
Sorry guys, total brain fart there :-) ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Fwd: Trying to enter text from a file to a Dictionary

2006-01-27 Thread Ben Markwell
Hi Ben,Yes, that's the point: Python doesn't know when to stop.  *grin* The way we've rewritten the loop:while True:...is an "infinite" loop that doesn't stop unless something in the loop'sbody does something extraordinary, like "breaking" out of the loop. Python is much dumber than we

Re: [Tutor] Fwd: Trying to enter text from a file to a Dictionary

2006-01-27 Thread Danny Yoo
> Here's one way we can avoid the problem: > > while True: > word = f.readline() > defn = f.readline() > if not word or not defn: >break > ... > > Does this make sense? > > It does mostly...I don't see why you need the: > > if not word or not defn:

Re: [Tutor] FWD: How do I fix this error so that my exchange rates program will work?

2005-12-14 Thread Ismael Garrido
Simon Gerber wrote: >>store.write(rate + '\n') >> >> > >With this: > > store.write(`rate` + \n') > >Note that these are not your regular sungle quotes. You'll find them >above the tab key, under escape, on most standard keyboards. > > I have to say I don't like that. It's

Re: [Tutor] [Fwd: Re: Spanish text in BS problem]

2005-11-10 Thread Hugo González Monteverde
Hi Ismael, I'm glad you found the answer. It is very enlightening as I thought I had to do with locale and did some tests without getting the problem (I do not have BS installed now) As I speak Spanish this had got me worried. :/ Hugo Ismael Garrido wrote: > Found the problem myself. > (loo

Re: [Tutor] [Fwd: Re: Spanish text in BS problem]

2005-11-09 Thread Ismael Garrido
Found the problem myself. (look down) Ismael Garrido wrote: > This is the script: > > import BeautifulSoup > import os > > a = open("zona.htm") > text = a.readlines() > a.close() > > BS = BeautifulSoup.BeautifulSoup(str(text)) Apparently, str(text) is the cause of the problem. If instead I do:

Re: [Tutor] Fwd: File IO help

2005-10-28 Thread Kent Johnson
Liam Clarke wrote: > And, a question for the group, I've always found that line[:1] is a > complicated way of writing line[0]... is there any time when line[:1] > != line[0]? Actually I would say that the general case is for them to be different and in the special case where line is a string they

Re: [Tutor] Fwd: Saving command line keyed input?

2005-10-21 Thread w chun
On 10/21/05, Kent Johnson <[EMAIL PROTECTED]> wrote: > Ed Singleton wrote: > > A quick tip for the Windows command line. > > > > Ctrl-C, Ctrl-A etc don't work, neither does right-clicking > > (menu-click). However, right-clicking does work on the blue title > > bar. > > If you turn on Quick Edit (

Re: [Tutor] Fwd: Saving command line keyed input?

2005-10-21 Thread Kent Johnson
Ed Singleton wrote: > A quick tip for the Windows command line. > > Ctrl-C, Ctrl-A etc don't work, neither does right-clicking > (menu-click). However, right-clicking does work on the blue title > bar. > > Right-click on the blue title bar and then go down to Edit and then > you can Select All.

Re: [Tutor] [Fwd: Re: Consistant Overhead Byte Stuffing (COBS)algorithm help]

2005-10-08 Thread Kent Johnson
Michael Cotherman wrote: > The c code seems to be walking through the list moving > bytes from src to dst, but the python code below seems > to take one byte from src, start counitng up to the > value from 1 and appending each and every value along > the way to dst, no? Ah, right you are. You are

Re: [Tutor] [Fwd: Re: Consistant Overhead Byte Stuffing (COBS)algorithm help]

2005-10-07 Thread Michael Cotherman
The c code seems to be walking through the list moving bytes from src to dst, but the python code below seems to take one byte from src, start counitng up to the value from 1 and appending each and every value along the way to dst, no? -mike --- Alan Gauld <[EMAIL PROTECTED]> wrote: > > I am a

Re: [Tutor] [Fwd: Re: Consistant Overhead Byte Stuffing (COBS)algorithm help]

2005-10-07 Thread Kent Johnson
Michael Cotherman wrote: >>... is the decoding code, it does what you >>describe below. It is adding the zeros back in, that >>is the dst.append('\0') >> >>Kent > > Really??? I am a noob, but it looks like it only puts > a \0 at the end if code (the length) is less than 255, > as the if statem

Re: [Tutor] [Fwd: Re: Consistant Overhead Byte Stuffing (COBS)algorithm help]

2005-10-06 Thread Michael Cotherman
> ... is the decoding code, it does what you > describe below. It is adding the zeros back in, that > is the dst.append('\0') > > Kent Really??? I am a noob, but it looks like it only puts a \0 at the end if code (the length) is less than 255, as the if statement is out of the for loop? thi

Re: [Tutor] [Fwd: Re: Consistant Overhead Byte Stuffing (COBS)algorithm help]

2005-10-05 Thread Kent Johnson
Michael Cotherman wrote: > def UnStuffData(src,dst,len): > >for code in src: > for i in range(1,code): > dst.append(i) > > if code < 0xff > dst.append('\0') > > the above is the below code uncommented... > it(and the original code) just seem to find the end

Re: [Tutor] [Fwd: Re: Consistant Overhead Byte Stuffing (COBS)algorithm help]

2005-10-05 Thread Michael Cotherman
def UnStuffData(src,dst,len): for code in src: for i in range(1,code): dst.append(i) if code < 0xff dst.append('\0') the above is the below code uncommented... it(and the original code) just seem to find the end and puts a zero there... I do not see the exis

Re: [Tutor] [Fwd: Re: Consistant Overhead Byte Stuffing (COBS)algorithm help]

2005-10-05 Thread Michael Cotherman
This is exactly what i was looking for For those following, the \x00 added at the end of the packet is just imaginary and represents in the meantime, I made the following that just 'decobs' a series of packets (only 8-10 bytes) that are coming in over the com port. (my incoming packets also b

Re: [Tutor] [Fwd: Re: Consistant Overhead Byte Stuffing (COBS)algorithm help]

2005-10-05 Thread Kent Johnson
Alan Gauld wrote: >> return (UINT)(dst - dstStart); >> } > > > This looks odd, I don't think I understand what it does. > It seems to return an address thats potentially (probably?!) > before the start of the original dst... It's returning the length of dst. Kent __

Re: [Tutor] [Fwd: Re: Consistant Overhead Byte Stuffing (COBS)algorithm help]

2005-10-05 Thread Alan Gauld
> I am a noob to converting pointers in C++ to arrays in > python, although the first time I see it done, I will > have no problem. Can you help converting the below > (what I think is the 'decoder' section) to python? It won't be working code but I think this is whats happening... > UINT CCobsPa

Re: [Tutor] Fwd: Fwd: Python riddles

2005-05-09 Thread Roel Schroeven
Alberto Troiano wrote: > Now I'm stucked in the riddle 6 > > As I understand I have to find a secret file (which I have but inside there > is like 900 files) > and do something with it One of the files has a name that is unlike all the other ones; take a look at that one. > Is it like number

Re: [Tutor] Fwd: Fwd: Python riddles

2005-05-09 Thread Alberto Troiano
>From: "D. Hartley" <[EMAIL PROTECTED]> >Reply-To: "D. Hartley" <[EMAIL PROTECTED]> >To: Alberto Troiano <[EMAIL PROTECTED]> >Subject: Re: [Tutor] Fwd: Fwd: Python riddles >Date: Sat, 7 May 2005 17:45:32 -0700 > >Alberto, "banner" i

<    1   2   3   4   5   >