Re: [Tutor] Generating Deck Combinations

2009-06-20 Thread Dave Angel
Michael Morrissey wrote: I need to generate all possible deck combinations given two different lists as input. The Input: List 1 has Card names listed inside it. List 2 has Maximum Quantities for each Card name. For example: List1[0] would be: "Aether Vial" List2[0] would be: "4" List1[1]

Re: [Tutor] newton's method for system of nonlinear equations

2009-06-26 Thread Dave Angel
kgotlele...@galmail.co.za wrote: Hi, I am trying to write a program in python that solves a system of nonlinear equations using newton's method. I don't know what I am doing wrong. Please help First thing wrong is posting two messages in the mailing list in rapid succession (7 minutes) wit

Re: [Tutor] Very basic Python question

2009-06-27 Thread Dave Angel
Daniel Sato wrote: Hi, Let me preface this by saying that I purchased O'Reilly's "Learn Python" yesterday and have no programming experience (I am a photographer by trade) except for a semester of what I think was BASIC on some old apple back in elementary school (circa 1992). I am not sure w

Re: [Tutor] intefaces in python

2009-06-29 Thread Dave Angel
Amit Sethi wrote: Well I want to implement plug-in like mechanism for an application . I want to define some minimum functions that any body writing a plugin has to implement. For that i thought an interface would be best because in a scenario where the function is not implemented some kind of

Re: [Tutor] Tutor Digest, Vol 64, Issue 128

2009-06-29 Thread Dave Angel
Amit Sethi wrote: . On Mon, Jun 29, 2009 at 5:01 PM, Dave Angel wrote: > > Amit Sethi ?wrote: > >> Well I want to implement plug-in like mechanism for an application . I want >> to define some minimum functions that any body writing a plugin has to >> imple

Re: [Tutor] About the vertical bar input

2009-06-29 Thread Dave Angel
"hyou" wrote: Hello, I'm trying to write a script that simply execute a command line like: C:\...(path)..\Devenv solution /build "Debug|Win32" However, in Python the "|" symbol is reserved thus I just can't make the command line above working once I added the "|" sign in it. How

Re: [Tutor] Need help with python game program

2009-06-30 Thread Dave Angel
jonathan wallis wrote: My problem is simple, is their a way to make a variable equal multiple numbers? Such as X = 5 through 10, and then the program makes x equal something random 5 through 10, or something similar. For a short question, why did you quote an entire mailing list digest?

Re: [Tutor] Python Programming exercise

2009-07-01 Thread Dave Angel
Daniel Sato wrote: I have been going through some Python Programming exercises while following the MIT OpenCourseWare Intro to CS syllabus and am having some trouble with the first "If" exercise listed on this page: http://en.wikibooks.org/wiki/Python_Programming/Conditional_Statements#If_Ex

Re: [Tutor] printing tree structure

2009-07-03 Thread Dave Angel
karma wrote: Hi all , I have a nested list in the structure [root,[leftSubtree],[RightSubtree]] that I want to print out. I was thinking that a recursive solution would work here, but so far I can't quite get it working. This is what I have so far: Can someone suggest whether this is suited to

Re: [Tutor] thesaurus

2009-07-10 Thread Dave Angel
Alan Gauld wrote: "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] thesaurus

2009-07-10 Thread Dave Angel
Kent Johnson wrote: On Fri, Jul 10, 2009 at 7:08 AM, Dave Angel wrote: Alan Gauld wrote: 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 Or the expression: &quo

Re: [Tutor] thesaurus

2009-07-11 Thread Dave Angel
Pete Froslie wrote: thanks for the advice Alan.. I am wondering about the following: new_word = response3[2] old_word = response[word_number] #this works but adds carriage returns* for line in fileinput.FileInput("journey_test.txt",inplace=1): line = line.replace(old_word, new_word)

Re: [Tutor] thesaurus

2009-07-11 Thread Dave Angel
Pete Froslie wrote: the trailing comma is getting me much closer right away! -- will read about the other options you suggest (rstrip(); stdout: write()) I clearly have a few other issues I need to sort out now. i guess I've been assuming that print was a good way to trace what is happening rathe

Re: [Tutor] String manipulation: Pig latin translator

2009-07-12 Thread Dave Angel
Eddie wrote: Hi guys, What I have here is more of a logic problem that I can't get my head around than a programming problem. I am trying to program an English to Pig Latin translator. I've got the English to Pig Latin part down and its working great. The part I am having difficulty with is the

Re: [Tutor] thesaurus

2009-07-12 Thread Dave Angel
Pete Froslie wrote: so, I've been playing with the functions a bit-- took a little time to get the hang of them after I started that other mess. Initially, I've done the opposite suggested here by creating functions without the input values. I do see the where it will pay off in re-usability that

Re: [Tutor] Pythonify this code!

2009-07-13 Thread Dave Angel
Muhammad Ali wrote: Hi, This is my first attempt at python. I tried my hand at steganography for fun. The code includes separate, combine, encode, decode functions. The separate function takes a number and it's base and returns a list containing each digit of the number in a list, vice versa for

Re: [Tutor] thesaurus

2009-07-13 Thread Dave Angel
Pete Froslie wrote: The url function btw: def url(): fin = open("journey_test.txt", "r") response = re.split(r"[/|/,\n, , ,:\"\"\.?,)(\-\<>\[\]'\r']", fin.read()) thesaurus = API_URL + response[word_number] + '/' #API_URL is established at the start of the code return thesaurus

Re: [Tutor] for statement with addition ...

2009-07-13 Thread Dave Angel
Markus Hubig wrote: Hi @all, within diveintopython I often found a for-statement like this: f for f in bla: print f So what actually is the first f for ... is it just to declare f before starting the for loop? I can't find any information on python.org and it's hard to google this kinda st

Re: [Tutor] Pythonify this code!

2009-07-14 Thread Dave Angel
A.T.Hofkamp wrote: Muhammad Ali wrote: def separateToList(num): """ changes an integer into a list with 0's padded to the left if the number is in tens or units """ assert(num <= 255) s = str(num) li = [] if len(s) > 2: li = [s[0:1], s[1:2], s[2:3]]

Re: [Tutor] unittests, testing a type

2009-07-14 Thread Dave Angel
On Tue, Jul 14, 2009 at 9:59 AM, Todd Matsumoto wrote: The reason why is I'm receiving the Decimal value from another program, if I already know that the value will be a Decimal why test it? How are you receiving it? File, pickle, pipe, socket, exit() return value? When I first read

Re: [Tutor] unittests, testing a type

2009-07-16 Thread Dave Angel
if I don't have a value that is a Decimal object something is wrong. Cheers, T Original-Nachricht Datum: Tue, 14 Jul 2009 22:36:14 -0400 Von: Dave Angel An: CC: Todd Matsumoto , tutor@python.org Betreff: Re: Re: [Tutor] unittests, testing a type On T

Re: [Tutor] objects becoming pointers

2009-07-16 Thread Dave Angel
chris Hynes wrote: That's just it, you won't know in advance what names the user will type in. Maybe I mean to say dynamically create pointers. For instance, In the morning, I might be working with data regarding methanol and do several iterations and save those iterations in separate arrays wi

Re: [Tutor] demo/turtle

2009-07-22 Thread Dave Angel
roberto wrote: On Wed, Jul 22, 2009 at 7:06 PM, Alan Gauld wrote: "roberto" wrote i'd like to download the demo/turtle directory but i could not find the correct link; i need it to run the exampled cited in http://docs.python.org/library/turtle.html can you tell me where to find it ?

[Tutor] Bouncing mail

2009-07-22 Thread Dave Angel
Geneviève DIAGORN wrote: Bonjour, Je suis absente jusqu'au 23/07 inclus. Je prendrai connaissance de votre mail vendredi. En cas d'urgence Soprane, contacter Benoît Tottereau ou William Dibas. Cordialement. Geneviève If you must use an "out of office" auto-reply, then unsubscribe to the ma

Re: [Tutor] Reading text until a certain point

2009-07-24 Thread Dave Angel
vince spicer wrote: you can build a dictionary and keep the active key, again this would only work in predictable data users = {} name = None for line in file: key, value = [x.strip() for x in line.split(":")] if key == "name": name = data[1] users[name] = {} else:

Re: [Tutor] What kind of number is this

2009-07-25 Thread Dave Angel
Emad Nawfal (9E'/ FHAD) wrote: Hi Tutors, I have a bunch of text files that have many occurrences like the following which I believe, given the context, are numbers: ١٨٧٢ ٥٧ ٢٠٠٨ etc. So, can somebody please explain what kind of numbers these are, and how I can get the original numbers bac

Re: [Tutor] Syntax Problem

2009-07-25 Thread Dave Angel
Jesse Harris wrote: for d in Decks.all(): #loop thru all available decks self.response.out.write(''+d.name) self.response.out.write(''+d.description) self.response.out.write('') self.response.out.write('') : invalid syntax (main.py, line 206) args = ('invalid syntax'

Re: [Tutor] Reading Data From File

2009-07-25 Thread Dave Angel
Chris Castillo wrote: Okay I really need help with the program I am writing. I've can't seem to figure out what I need to do and have tried several different methods. I need to read in a text file in python that contains the following: Student Name ( could be unknown amount in file ) Numeric G

Re: [Tutor] Reading Data From File

2009-07-25 Thread Dave Angel
ctc...@gmail.com wrote: grades = [] names = [] gradeTotal = 0 numStudents = 0 inputFile = open("input.txt", "r" for line in inputFile: if line.strip().isdigit(): grade = float(line) if grade != 0.0: gradeTotal += grade grade = grades.append(grade) else: name = line.strip() name = names.append(n

Re: [Tutor] Reading Data From File

2009-07-26 Thread Dave Angel
ll wouldn't be right because I'm processing everything all at once with no way to reference any of the grades with the student. How do I structure this differently to do that? That's what I'm having trouble with. On 7/25/09, Dave Angel wrote: ctc...@gmail.com wrote:

Re: [Tutor] First code snipet

2009-07-26 Thread Dave Angel
Darth Kaboda wrote: Subject: Re: [Tutor] First code snipet From: andr...@kostyrka.org To: darthkab...@msn.com CC: tutor@python.org Date: Sun, 26 Jul 2009 03:02:27 +0200 Some things: 1) It's Python, not Phython. 2) Slightly shorter solution to your problem: import random input = range(53

Re: [Tutor] simple text replace

2009-07-26 Thread Dave Angel
j booth wrote: Hello, I am scanning a text file and replacing words with alternatives. My difficulty is that all occurrences are replaced (even if they are part of another word!).. This is an example of what I have been using: for line in fileinput.FileInput("test_file.txt",inplace=1):

Re: [Tutor] simple text replace

2009-07-27 Thread Dave Angel
Albert-Jan Roskam wrote: Hi! Did you consider using a regex? import re re.sub("python\s", "snake ", "python is cool, pythonprogramming...") Cheers!! Albert-Jan --- On Mon, 7/27/09, Dave Angel wrote: From: Dave Angel Subject: Re: [Tutor] simple text re

Re: [Tutor] First code snipet

2009-07-27 Thread Dave Angel
Darth Kaboda wrote: Good point. It is important to state your goal for the code, preferably in comments in your code, as well as in the message asking us the question. Suggest you include a doc-string for each class and method declaration. But it's important to tell us how you expect to use i

Re: [Tutor] renaming files within a directory

2009-07-27 Thread Dave Angel
davidwil...@safe-mail.net wrote: Here is the updated viersion: --- import glob import csv from os import rename countries =} reader =sv.reader(open("countries.csv")) for row in reader: code, name =ow countries[name] =ode files =et([file for file in glob.glob('Flag_of_*.svg')]) for f

Re: [Tutor] How to use Python 2.6 with IDLE?

2009-07-27 Thread Dave Angel
Gregor Lingl wrote: Dick Moores schrieb: I've taken a long break from Python, and now I want to try scripting with 2.62. I downloaded and installed 2.62, changed Win XP environmental variables to use Python26. Entering python at the command line shows I'm using 2.62: C:\Documents and Settings\R

Re: [Tutor] How to use Python 2.6 with IDLE?

2009-07-27 Thread Dave Angel
Dick Moores wrote: On Mon, Jul 27, 2009 at 04:27, Gregor Lingl wrote: Dick Moores schrieb: I've taken a long break from Python, and now I want to try scripting with 2.62. I downloaded and installed 2.62, changed Win XP environmental variables to use Python26. Entering python at the comm

Re: [Tutor] How to use Python 2.6 with IDLE?

2009-07-27 Thread Dave Angel
Dick Moores wrote: On Mon, Jul 27, 2009 at 04:27, Gregor Lingl wrote: Dick Moores schrieb: I've taken a long break from Python, and now I want to try scripting with 2.62. I downloaded and installed 2.62, changed Win XP environmental variables to use Python26. Entering python at the comm

Re: [Tutor] Eng to Leet Speek

2009-07-27 Thread Dave Angel
Chris Castillo wrote: so I have a string: 1 4|-| 50 |_33+. I love [#ick3n 4nd ch3353. Don't you love +|_|2|\e7 \/\/1+# the |#a|-|i|_7? and I am trying to turn it into english with the following code: fileIn = open("encrypted.txt", "r").read() def eng2leet(astring): astring = astring.re

Re: [Tutor] How to use Python 2.6 with IDLE?

2009-07-28 Thread Dave Angel
Dick Moores wrote: I'm not sure how to edit it. What's required for Ulipad is quite different, I believe. This is what I got from Dave Angel: e: cd \Python26\Lib\idlelib\ ..\..\pythonw.exe idle.pyw %* And I can't decipher it. What is the "..\..\"? Just ask.

Re: [Tutor] Help...

2009-07-28 Thread Dave Angel
Ryan V wrote: For this source code, i am getting some errors, and not sure how to fix it, as i am returning all the values. it is telling me that there is no value for the variables i am returning. any help is greatly appreciated! Source #main function def main(): print 'The menu is:' pr

Re: [Tutor] self.name vs. passing a name

2009-07-28 Thread Dave Angel
Che M wrote: This is another very basic structural question, related to one I asked last week, and again is not necessarily germane only to Python. Let's say you have a sequence of two calculations or manipulations you need to do, each one done as a function called by an overall calculate_some

Re: [Tutor] how to get blank value

2009-07-28 Thread Dave Angel
amr...@iisermohali.ac.in wrote: It is not giving any value, without any error ph08...@sys53:~> python trial.py ph08...@sys53:~> it is coming out from shell. Thanks for help. Amrita amr...@iisermohali.ac.in wrote: Sorry to say, but till now I have not got the solution of my problem, I

Re: [Tutor] concerning help() function

2009-07-29 Thread Dave Angel
David wrote: Dear Tutors, whenever I make use of the help() function, I have a good chance of getting an error. I have not yet understood this tool very well. Take the modules operator and random as examples. The former is built-in, the latter not. Do I wish to see the help files, I have to use

Re: [Tutor] manipulating lists

2009-07-29 Thread Dave Angel
(You omitted a title, so I made one up. Hope it's okay) Chris Castillo wrote: # Module demonstrates use of lists and set theory principles def Unite(set1, set2): # evaluate 2 lists, join both into 1 new list newList = [] for item in set1: newList.append

Re: [Tutor] flag to call methods on objects?

2009-07-30 Thread Dave Angel
prasad rao wrote: hello I wanted to prevent other users of my computers to read my files. So tried to creat a module to achieve it. I used a flag to deside which methods to be called on the object. somehow it is not working.I realise after 2 days of struggle that as it is usuel , I am blind

Re: [Tutor] flag to call methods on objects?

2009-07-30 Thread Dave Angel
prasad rao wrote: On 7/30/09, Dave Angel wrote: prasad rao wrote: hello "it is not working." is not very descriptive. DaveA Hello! Sorry, I forgot to mention the problem. It simply wipes clean the file,resulting in empty file. Yes

Re: [Tutor] Assigning each line of text to a separate variable

2009-07-30 Thread Dave Angel
Marv Boyes wrote: Hello, all. This is probably embarrassingly basic, but I haven't been able to find something that works. I'm working on a script that needs to manipulate a list (not 'list' in the Python sense) of URLs returned in a server response. Right now, I'm stripping the XML tags fro

Re: [Tutor] Assigning each line of text to a separate variable

2009-07-30 Thread Dave Angel
Marv Boyes wrote: I'm very sorry; I should have been more explicit in what it is I'm working with. The response from the server consists of a pair of hashes and a list of URLs for doing different things with the file the hashes represent. So the full response is like this: file_hash

Re: [Tutor] flag to call methods on objects?

2009-07-31 Thread Dave Angel
prasad rao wrote: hello I removed the bugs.But still getting error report. import mcript Traceback (most recent call last): File "", line 1, in import mcript File "C:\Python26\mcript.py", line 78, in a.main() File "C:\Python26\mcript.py", line 58, in main nl=__

Re: [Tutor] mnemonics to better learn Python

2009-07-31 Thread Dave Angel
Eduardo Vieira wrote: Hello, would anybody have a good memorization technique for boolean results? Like when using 'or'/'and' what it returns when both are false, the last is false, etc? I find it so hard to remember that... Eduardo I don't blame you for finding it hard to remember. The

Re: [Tutor] flag to call methods on objects?

2009-08-01 Thread Dave Angel
(You replied off-list, so I'm copying your email, plus my response, to the list) prasad rao wrote: >I still see four problems. Hello Dave.I made modification as suggested by you. You made the first three. But the problem of zlib.compress() producing a string with an embedded (0a) sti

Re: [Tutor] Configuaration files and paths?

2009-08-05 Thread Dave Angel
Allen Fowler wrote: What is the recommended way to configure my application find the various database and/or configuration files it needs? Recommemded by whom? A lot depends on the OS. Apple for example have one set of recommendations for MacOS, Windows has another and Linux has several

Re: [Tutor] noob question (Windows, Python 3.1)

2009-08-06 Thread Dave Angel
Michael Connors wrote: 2009/8/6 Joshua Harper Ok, so I am trying to learn python, and I am reading many tutorial type things and I am kind of stuck with implementing some of the code... so for example the tutorial says "*To get the examples working properly, write the programs in a text fil

Re: [Tutor] monitor number of files in a folder

2009-08-06 Thread Dave Angel
pedro wrote: On 2009-08-06 15:49:35 -0400, Wayne said: On Thu, Aug 6, 2009 at 2:33 PM, pedro wrote: Hi I am rendering image sequences on a basic render farm that I am building. Once all the files in the sequence have been rendered I would like to make a quicktime of the sequence automat

Re: [Tutor] Noobish Syntay Error?

2009-08-06 Thread Dave Angel
Anna - Sophie Maeser wrote: Hi! I want to ask you a quick question.. when I type in print '' hello world'' and then press enter, it says there is a syntax error... I really don't know what im doing wrong. I downloaded python 3.1 and am using IDLE with it.. im using mac. Please help me findt he

Re: [Tutor] Looking up a value in a dictionary from user input problem

2009-08-06 Thread Dave Angel
chase pettet wrote: I am trying to write a script to work our LVS implementation. I want to be able to have user do something like this "./script SITE SERVER" and have the script look up the ip value of the site on that server and issue the command to pull the status from LVS. I am almost ther

Re: [Tutor] monitor number of files in a folder

2009-08-06 Thread Dave Angel
Sander Sweers wrote: 2009/8/6 Dave Angel : You have to choose your poison. I prefer no poison. This is exactly what inotiy was made for and although I never used it there is a python module for it [1]. It would be great if you can post your experience with it. Greets Sander [1] http

Re: [Tutor] this module

2009-08-08 Thread Dave Angel
Mark Young wrote: Hi, I was reading a tutorial, and it mentioned the "import this" easter egg. I was curious, and looked up the contents of the module, and dscovered that it had attributes c, d, i, and s. I was wondering if anyone had any clue what these attributes were supposed to mean. I think

Re: [Tutor] droplet like behaviour in Python

2009-08-10 Thread Dave Angel
bob gailer wrote: Alan Gauld wrote: "pedro" wrote Well I made a script called droplet.py which looks like this: #!/usr/bin/env python # encoding: utf-8 import sys theFilePath = sys.argv[1] print theFilePath But when I try to drop something on it nothing happens. Sorry I guess there is some

Re: [Tutor] To write data in two different fonts?

2009-08-11 Thread Dave Angel
prasad rao wrote: Hello I am wtriting some dat on to a file in which headings should be of different size than other data. Is it possible?If possible please tell me how to do it. def sc(adir): import os,myfiles dest=open('C:/scripts.txt','w') s=myfiles.myfiles(adir)

Re: [Tutor] list question

2009-08-11 Thread Dave Angel
Wayne wrote: On Tue, Aug 11, 2009 at 7:17 AM, wrote: hi i am currently doing the 'livewires' python tutorial lesson 5. i am making a little game that makes a few squares chase a circle around a little grid. i can get the 1 square acting on 1 variable to come up, but the tutorial now wants

Re: [Tutor] To write data in two different fonts?

2009-08-11 Thread Dave Angel
prasad rao wrote: Hello I modified my code.But I am gettingmy my lines stripped of indentation. What should I do to avoid it?Sorry if it is not about Python. def sc(adir): import os,myfiles dest=open('C:/scripts.html','w') s=myfiles.myfiles(adir) dest.write('')

Re: [Tutor] To write data in two different fonts?

2009-08-11 Thread Dave Angel
Michael M Mason wrote: Dave Angel wrote on 11 August 2009 at 16:42:- The brute-force way might be to replace each space in "l" with   which is a "nonbreaking space." But I think you want the tag, which means the text is pre-formatted. And you could

Re: [Tutor] To write data in two different fonts?

2009-08-12 Thread Dave Angel
prasad rao wrote: But I think you want the tag, which means the text is pre-formatted. And you could >put that around the whole sorce file, instead of doing for each line. See http://www.w3schools.com/tags/tag_pre.asp Thank you Dave. I put in tag and it worked. But

Re: [Tutor] To write data in two different fonts?

2009-08-12 Thread Dave Angel
prasad rao wrote: xml.sax.saxutils.escape(/data/[, /entities/]) Escape '&', '<', and '>' in a string of data. > You can escape other strings of data by passing a dictionary as the >optional /entities/ parameter. The keys and values must all be >strings; each key will be repla

Re: [Tutor] To write data in two different fonts?

2009-08-13 Thread Dave Angel
Nick Raptis wrote: Dave Angel wrote: As I said, you'd probably get in trouble if any of the lines had '&' or '<' characters in them. The following function from the standard library can be used to escape the line directly, or of course you coul

Re: [Tutor] Dynamic Function Calls

2009-08-14 Thread Dave Angel
bob gailer wrote: Megan Land wrote: All three methods are defined below the snippet I provided. In Python names must be defined before they are referenced. Put these defs above the snippet. def func(): code... def func0(): do stuff def func1(): do stuff def func2(): do stuff Megan Land

Re: [Tutor] Dynamic Function Calls

2009-08-14 Thread Dave Angel
Megan Land wrote: From: Dave Angel

Re: [Tutor] write program to extract data

2009-08-14 Thread Dave Angel
Michael Miesner wrote: Hi- I work in a research lab and part of the lab I'm not usually associated with uses a program that outputs data in a .txt file for each participant that is run. The participant # is the title of the text document (ie E00343456.txt) style and I'd like to be able to take th

Re: [Tutor] Dynamic Function Calls

2009-08-14 Thread Dave Angel
Megan Land wrote: I tried what you said. I can call the function by itself (not within the dictionary). I also printed the help(__name__). All of my functions were listed. Here's a more representative example of my code (I doing this for work so I don't want to give my entire program away):

Re: [Tutor] python's database

2009-08-15 Thread Dave Angel
davidwil...@safe-mail.net wrote: Hello, I seem to remember that python had a native database, can someone remind me which this was. Dave Check out module sqlite3 http://docs.python.org/library/sqlite3.html ___ Tutor maillist - Tutor@python.or

Re: [Tutor] Loop help

2009-08-16 Thread Dave Angel
Nathan Wing wrote: Hello All,I've been racking my brain trying to figure out, what I imagine to be, a very simple problem. I found the Intro to comp science MIT open course ( http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Science/6-00Fall-2007/CourseHome/index.htm) and was working

Re: [Tutor] yet another question on OO inheritance

2009-08-18 Thread Dave Angel
Serdar Tumgoren wrote: Thanks to you both for the suggestions. I think I'll try the approach below. But just one follow-up: should I be setting "self.tablename", or is a static attribute ("tablename") the correct approach? A nice way to do this is with a class attribute. For example: class C

Re: [Tutor] handling a textfile

2009-08-19 Thread Dave Angel
Alan Gauld wrote: "Olli Virta" wrote I have a textfile (job.txt) that needs modifying. The structure of this file is like this: AAA1... BBB1... CCC1... AAA2... BBB2... CCC2... etc... Question is how can I turn this all to a textfile (done.txt) that is suppose to look like this: AAA1...BB

Re: [Tutor] how do we represent left arrow key in python programming.

2009-08-21 Thread Dave Angel
Ajith Gopinath wrote: Hi Folks, how do we represent left arrow key in a python program? Can anybody help? || a j i t || Be more specific. Are you writing your gui in wxpython, in gtk, in tkinter? Or are you writing a console program? In what Python version? Are you looking to see how an

Re: [Tutor] Template long text substitution

2009-08-24 Thread Dave Angel
Stefan Lesicnik wrote: Hi Guys, I am trying to do the following, and im not sure how to deal with a blob of text. I have the following file i am using as a template %%NAME%% %%NUMBER%% %%REPORT%% and i have a corresponding file with values name="bob" number="123" report="report is long and s

Re: [Tutor] Declaration order of classes... why it is important?

2009-08-26 Thread Dave Angel
Kent Johnson wrote: On Wed, Aug 26, 2009 at 12:25 PM, Mac Ryan wrote: Hello everybody, I am using "storm" (https://storm.canonical.com/) to manage my database. In storm, relationships between tables (each table is represented by a class) are expressed like this (line #4): 1 >>> class

Re: [Tutor] Declaration order of classes... why it is important?

2009-08-26 Thread Dave Angel
Mac Ryan wrote: On Wed, 2009-08-26 at 15:46 -0400, Dave Angel wrote: So define a classmethod to finish the job, and invoke it later class Employee(object): @classmethod def finish(cls): cls.__storm_table__ = "employee" cls.company_id = [] c

Re: [Tutor] how do I post event to thread?

2009-08-26 Thread Dave Angel
Jeff Peery wrote: hello, I've read a bit about multi thread communication, and found that most people use a queue, which makes sense. however in my case I simply have two threads, a main thread and one other. the main thread is doing many different things and the second thread is receiving num

Re: [Tutor] design advise

2009-08-27 Thread Dave Angel
Alan Gauld wrote: wrote The thing that bothers me is that I ma have 10 users or 100,000 users and really wanted to get an opinion as to which option would scale better, leaving aside the relational DB approach. If you have to cater for 100,000 users all with different views on a common se

Re: [Tutor] Declaration order of classes... why it is important?

2009-08-28 Thread Dave Angel
Mac Ryan wrote: On Wed, 2009-08-26 at 21:32 -0400, Dave Angel wrote: Now there are a couple of decorators that are in the standard library that everyone should know about:classmethod() and staticmethod(). They wrap a method in a new one (which ends up having the same name), such that

Re: [Tutor] Declaration order of classes... why it is important?

2009-08-28 Thread Dave Angel
Mac Ryan wrote: On Fri, 2009-08-28 at 08:55 -0400, Dave Angel wrote: Mac Ryan wrote: On Wed, 2009-08-26 at 21:32 -0400, Dave Angel wrote: Now there are a couple of decorators that are in the standard library that everyone should know about:classmethod() and staticmethod

Re: [Tutor] Callbacks in Python

2009-08-28 Thread Dave Angel
Jramak wrote: Thanks everyone for your excellent insights. I think I understand the callback concept better. So, it is like passing a function as an argument to another function. I am interested in learning more about how callbacks can be applied in GUIs, using wxPython as an example. Would appr

Re: [Tutor] What does it mean to create separate applications?

2009-08-28 Thread Dave Angel
Kristina Ambert wrote: Hi, I'm new to python and frankly new to programming. This is my first question post, so I hope everyone could bear with me. I'm working on a small database application which basically handles a store inventory, it's my internship project for the semester. My boss asked me

Re: [Tutor] packing a list of lists

2009-08-28 Thread Dave Angel
kevin parks wrote: Back to python after a long long layoff. So i am running into some beginner's confusion... I am trying to plot a list of numbers in gnuplot.py. To do that I am trying to pack the list with an index by iterating over the list so i can get something like: foo = [12, 11, 9,

Re: [Tutor] working with multiple sets

2009-09-05 Thread Dave Angel
kevin parks wrote: I am doing some simple things with sets and so far have had a lot of success with python's built-in sets, which is such a great new(ish) "batteries included" type python data type. [snip] [snip] -- [snip] [snip] -- #!/usr/bin/env

Re: [Tutor] How to print the next line in python

2009-09-12 Thread Dave Angel
ranjan das wrote: Hi, I am new to python and i wrote this piece of code which is ofcourse not serving my purpose: Aim of the code: To read a file and look for lines which contain the string 'CL'. When found, print the entry of the next line (positioned directly below the string 'CL') conti

Re: [Tutor] New guy question...

2009-09-14 Thread Dave Angel
(You're top-posting, which makes the message flow very confusing) Warren wrote: Well, I thought that as well but I took it out which makes it run under 2.6.1 and I get similar, but not exactly the same, output: Type integers, each followed by ENTER; or just ENTER to finish EOFError: EOF wh

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

2009-09-16 Thread Dave Angel
(Don't top-post; it makes reading the thread quite confusing) Ansuman Dash wrote: 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 cr

Re: [Tutor] IDLE colon = syntax error

2009-09-16 Thread Dave Angel
Carnell, James E wrote: I searched through archives and wasn't able to find the solution. Using IDLE, python 3, Ubuntu (default installations). Using command line: > if 1 == 1: print "equal" > equal Using IDLE: >if 1 == 1: print "equal"

Re: [Tutor] Problem running visual python files at home

2009-09-19 Thread Dave Angel
shsu012 shsu012 wrote: Hi Tutor, After installing python 2.6.2, there was no problem running it and completing the simple maths operations at home. However, a Microsoft Visual C++ Runtime library error keeps turning up whenever I tried to run the files which use functions imported from the visual

Re: [Tutor] list sort problem

2009-09-19 Thread Dave Angel
Rayon wrote: ok so here it is I think this one should be very clear: I have some data in a list, the data in question: 0.0046,0.095,0.0904,521456,['MCI 521456 0.0904'],['ATT 521 0.0919'],['IDT 521 0.095'],['None'] 0.0083,0.0192,0.0109,39023821,['MCI 39023821 0.0109'],['ATT 39 0.012'],['IDT

Re: [Tutor] list sort problem solved

2009-09-20 Thread Dave Angel
Rayon wrote: list = bigMethod() # this method makes the list list.sort() # here is the sort thanks for x in list: # out put the sort print x it all works Thanks a lot -- From: "Dave Angel" Sent: Saturday, September 19, 2009 7:46 PM

Re: [Tutor] python win32 drive mapping help

2009-09-22 Thread Dave Angel
Vineet Kothari wrote: Hi Everyone I saw alot of responses for python on this mailing list. I thought any python guru might wish to help me with little code to map two network drives on windows systems I have 3computers at different locations in a network A,B,C I want to ma

Re: [Tutor] calling a superclass method after overriding it

2009-09-22 Thread Dave Angel
Serdar Tumgoren wrote: def result_of_SPECIALIZED_SQLcall_for_child(): name =None return name class Child(Parent): def __init__(self): super(Child, self).__init__() def add_name(self): name = result_of_SPECIALIZED_SQLcall_for_child() try:

Re: [Tutor] how to define a function with multple parameters

2009-09-22 Thread Dave Angel
shellc...@juno.com wrote: I want to know how to use multiple parameters for 1 function def display(message): print message def rate_score(): score =ate_score if rate_score <=99: print "that's nothing." elif rate_score <=: print "ok." elif rate_score >=:

Re: [Tutor] calling a superclass method after overriding it

2009-09-22 Thread Dave Angel
Serdar Tumgoren wrote: An "if" test would be more readable, I agree. But I was trying to apply the "Easier to Ask Permission Forgiveness" style, discussed in the Python Cookbook: , Err..."Easier to Ask Forgiveness than Permission" approach is what I meant (perhaps proving my point about n

Re: [Tutor] calling a superclass method after overriding it

2009-09-22 Thread Dave Angel
Serdar Tumgoren wrote: def add_name(self): try: self.name = SPECIALIZED_SQLcall_for_child() except SpecialSQLError: #default to the superclass's add_name method super(Child, self).add_name() That certainly is a lot easier to read. So if I were to

Re: [Tutor] python win32 drive mapping help

2009-09-25 Thread Dave Angel
Vineet Kothari wrote: Can you also help me out with the way to delete the mapped drive I know in command line it is net use [DRIVE:] /delete but I am unable to figure out how I can do it from python Since I am trying to make sure that the drive name I am giving in my code: impo

<    1   2   3   4   5   6   7   8   9   10   >