Re: [Tutor] Misunderstanding the Entry Widget

2009-03-09 Thread Wayne Watson
Title: Signature.html On a branch off this thread, I've mentioned a problem with this approach. It seems right, but I haven't bridged it yet. Do you have some simple Tk Python code that shows how to do this? Alan Gauld wrote: "Wayne Watson" wrote Signature.htmlAnother thought occurre

Re: [Tutor] memory error

2009-03-09 Thread Moos Heintzen
On Fri, Mar 6, 2009 at 5:03 PM, Harris, Sarah L wrote: > fname=filter(isfile, glob.glob('*.zip')) > for fname in fname: > zipnames=filter(isfile, glob.glob('*.zip')) > for zipname in zipnames: > ... It looks you're using an unnecessary extra loop. Aren't the contents of fname sim

Re: [Tutor] Binary to Decimal conversion

2009-03-09 Thread Moos Heintzen
You're making it more complicated than it needs to. Also, you first used binnum then binum, and you didn't define binsum. It could easily be done like this: binnum = raw_input("Please enter a binary number: ") decnum = 0 rank = 1 for i in reversed(binnum): decnum += rank * int(i) rank *

Re: [Tutor] Tutor Digest, Vol 61, Issue 32

2009-03-09 Thread Alan Gauld
"WM." wrote From: "Alan Gauld" Pyton's error message told you exactly what you had done wrong although you may not have quite understood it. But do you now see what the error message was telling you when it said: ... Can you understand it clearly enough that when a similar error comes up in

Re: [Tutor] compare csv file values against a python dictionary and create a new list from this.

2009-03-09 Thread bob gailer
ski wrote: hello, i have created this function that compares the values of a csv file against a dictionary, you can see the code, here http://paste.lisp.org/display/76705 the affiliations list has 130 items. is there a better way to build the 'items' list? Please define "better". If you m

Re: [Tutor] Binary to Decimal conversion

2009-03-09 Thread bob gailer
Chris Castillo wrote: I am having some difficulties in producing the correct code for a simple binary to decimal conversion program. The arithmetic I want to use is the doubling method - so if I wanted to get the decimal equivalent of 1001, I would start with multiplying 0 * 2 and adding the l

Re: [Tutor] Binary to Decimal conversion

2009-03-09 Thread bob gailer
Chris Castillo wrote: I am having some difficulties in producing the correct code for a simple binary to decimal conversion program. The arithmetic I want to use is the doubling method - so if I wanted to get the decimal equivalent of 1001, I would start with multiplying 0 * 2 and adding the l

[Tutor] Binary to Decimal conversion

2009-03-09 Thread Chris Castillo
I am having some difficulties in producing the correct code for a simple binary to decimal conversion program. The arithmetic I want to use is the doubling method - so if I wanted to get the decimal equivalent of 1001, I would start with multiplying 0 * 2 and adding the left most digit. I would the

Re: [Tutor] comparing lists of dictionaries

2009-03-09 Thread Kent Johnson
On Mon, Mar 9, 2009 at 5:56 PM, ski wrote: > i was looking to list all the items in list1 that are not in list2 based on > the key['id] and key['affiliation'] respectively. OK. Generally, when you want to test for membership, a set or dict is a good choice. In this case, I would first make a set

Re: [Tutor] Tutor Digest, Vol 61, Issue 32

2009-03-09 Thread WM.
hen adds two because codes are every other entry ??? else: ??? print "No anagrams" ??? choice = raw_input("Continue? (yes/no)") ??? if choice == 'y' or choice == 'yes': ??? continue ??? else: ??? break ??? ??? ??? ??? ??? ??? ? ??? ???

Re: [Tutor] Newby Linux Program review + help with regular expressions

2009-03-09 Thread Alan Gauld
"David" wrote and compare with others, ask for help etc. Am I using the subrocess module too much because I am comfortable with the commands? Should I just write this type of program in bash. Personally I'd use bash for this kind of thing. If you wanted to post process the report then I'd u

Re: [Tutor] i can only write one line of code on python shell helpplease ?

2009-03-09 Thread Alan Gauld
"mustafa akkoc" wrote - In python shell , i can only write one line of code when I go to next line this sign appears >>> how can write the code like in script mode and run You can't. Shell mode means you are entering code directly into the interpreter so it executes the code line by li

Re: [Tutor] comparing lists of dictionaries

2009-03-09 Thread ski
i was looking to list all the items in list1 that are not in list2 based on the key['id] and key['affiliation'] respectively. thanks Kent Johnson wrote: On Mon, Mar 9, 2009 at 4:20 PM, ski wrote: what am i missing here, i would like to get a list of the diff between list1 and list2 What

Re: [Tutor] comparing lists of dictionaries

2009-03-09 Thread Kent Johnson
On Mon, Mar 9, 2009 at 4:20 PM, ski wrote: > what am i missing here, i would like to get a list of the diff between list1 > and list2 What do you mean by diff in this case? Items in one list and not in the other? Items that are in both lists but with different elements? What elements do you wan

[Tutor] comparing lists of dictionaries

2009-03-09 Thread ski
hello again, i am trying to get my head around this but without success, here is what i have so far: >>> list1 = [{'is_selected': False, 'id': 'AAC', 'title': 'Association of Airline Cons.'}, {'is_selected': False, 'id': 'AALA', 'title': 'Adv. Activity Licence. Auth.'}, {'is_selected': False,

Re: [Tutor] HELP ON A ANAGRAM PYTHON PROGRAM

2009-03-09 Thread christopher . henk
Just glancing at your program, I would guess that you have a ":" where you want a "]" on the line below. prod = prod * letter_to_prime[word_list[j] [i]: HTH, Chris jessica cruz Sent by: tutor-bounces+christopher.henk=allisontransmission@python.org 03/09/2009 02:38 PM To Tutor@p

[Tutor] Newby Linux Program review + help with regular expressions

2009-03-09 Thread David
This program generates a report of a Linux System and some important .conf files. The goal is for users to be able to post their information and compare with others, ask for help etc. Am I using the subrocess module too much because I am comfortable with the commands? Should I just write this t

Re: [Tutor] HELP ON A ANAGRAM PYTHON PROGRAM

2009-03-09 Thread wesley chun
On Mon, Mar 9, 2009 at 10:38 AM, jessica cruz wrote: > I made this program but it says that there is an error and I have a hard > time trying to solve the problem with program. >        : > I don't know how to figure out the error since the only message that I get > is that "there's an error: inva

Re: [Tutor] HELP ON A ANAGRAM PYTHON PROGRAM

2009-03-09 Thread Kent Johnson
On Mon, Mar 9, 2009 at 1:38 PM, jessica cruz wrote: > I don't know how to figure out the error since the only message that I get > is that "there's an error: invalid syntax" Please copy & paste the whole error message including the traceback so we know where the error is. Kent _

[Tutor] HELP ON A ANAGRAM PYTHON PROGRAM

2009-03-09 Thread jessica cruz
I made this program but it says that there is an error and I have a hard time trying to solve the problem with program. Here is the program: #this reads all of the words in the file into a list infile = open('/afs/cats/courses/cmps012a-cm/pa1/wordList.txt') wdcount = int(infile.readline()) #firs

Re: [Tutor] Misunderstanding the Entry Widget

2009-03-09 Thread Wayne Watson
Title: Signature.html I had commented out #    entry = Entry(master, width=10, textvariable=self.slowdownVar).grid(row=4, column=1), which had worked fine previously to my changes. I added your two statements after remarking entry = Entry(master, width=10).grid(row=4, column=1) IDLE & th

[Tutor] creating a list of all imported modules

2009-03-09 Thread Tim Michelsen
Hello, how do I create a list of all modules imported by my module/script? I am looking for something like %who in Ipython. Thanks for your help in advance. Regards, Timmie ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/li

[Tutor] compare csv file values against a python dictionary and create a new list from this.

2009-03-09 Thread ski
hello, i have created this function that compares the values of a csv file against a dictionary, you can see the code, here http://paste.lisp.org/display/76705 the affiliations list has 130 items. is there a better way to build the 'items' list? thanks norman ___

Re: [Tutor] creating new dictionary based on membership testing

2009-03-09 Thread ski
thank you all, great feedback. Sander Sweers wrote: 2009/3/9 A.T.Hofkamp : You can do something like [d for d in d1 if d['is_selected'] == False] to get your dicts. If 'is_selected' is not always present, it gets a bit more complicated, I'll leave that as an exercise for the interested reader

Re: [Tutor] creating new dictionary based on membership testing

2009-03-09 Thread Kent Johnson
On Mon, Mar 9, 2009 at 10:28 AM, ski wrote: > hello, > > i have this list which contains a number of dictionaries. > d1 = [{'is_selected': False, 'id': 'AAC', 'title': 'Association of Airline Cons.'}, {'is_selected': False, 'id': 'AALA', 'title': 'Adv. Activity Licence. Auth.'}, {'is

Re: [Tutor] creating new dictionary based on membership testing

2009-03-09 Thread Sander Sweers
2009/3/9 A.T.Hofkamp : > You can do something like > [d for d in d1 if d['is_selected'] == False] > to get your dicts. > > If 'is_selected' is not always present, it gets a bit more complicated, I'll > leave that as an exercise for the interested reader :) You would use d.get('is_selected', False)

Re: [Tutor] creating new dictionary based on membership testing

2009-03-09 Thread A.T.Hofkamp
ski wrote: hello, i have this list which contains a number of dictionaries. >>>d1 = [{'is_selected': False, 'id': 'AAC', 'title': 'Association of Airline Cons.'}, {'is_selected': False, 'id': 'AALA', 'title': 'Adv. Activity Licence. Auth.'}, {'is_selected': False, 'id': 'ABPCO', 'title': 'A

Re: [Tutor] i can only write one line of code on python shell help please ?

2009-03-09 Thread David
mustafa akkoc wrote: > Hello , > > - In python shell , i can only write one line of code when I go to > next line this sign appears >>> how can write the code like in > script mode and run > > thanks > -- > Mustafa Akkoc >

[Tutor] creating new dictionary based on membership testing

2009-03-09 Thread ski
hello, i have this list which contains a number of dictionaries. >>>d1 = [{'is_selected': False, 'id': 'AAC', 'title': 'Association of Airline Cons.'}, {'is_selected': False, 'id': 'AALA', 'title': 'Adv. Activity Licence. Auth.'}, {'is_selected': False, 'id': 'ABPCO', 'title': 'Association of

Re: [Tutor] Misunderstanding the Entry Widget

2009-03-09 Thread Wayne Watson
Title: Signature.html Very good. Thanks. (I posted this about 20 hours ago with an image of my screen output. It appears it's waiting for moderator approval, so I'm posting it again w/o the image. Maybe the image will show up later. I think some progress can be made with out it. ) Well, the i

[Tutor] i can only write one line of code on python shell help please ?

2009-03-09 Thread mustafa akkoc
Hello , - In python shell , i can only write one line of code when I go to next line this sign appears >>> how can write the code like in script mode and run thanks -- Mustafa Akkoc ___ Tutor maillist - Tutor@python.org http://mail.python.org/mail

Re: [Tutor] if inside if help python

2009-03-09 Thread Senthil Kumaran
> I have question  if we make if statement inside if  like cprogramming below > how to do  in python Indentation is the key here. It is very simple. x=1 y=2 if x == 1: print "inside first if" if x == 2: print "inside second if" -- Senthil ___

[Tutor] if inside if help python

2009-03-09 Thread mustafa akkoc
I have question if we make if statement inside if like cprogramming below how to do in python int x-1 , y=2; if (x==1) { printf(" inside first if "); if (y==2) { printf ("inside second if "); } } -- Mustafa Akkoc __

[Tutor] Excel addin in Python

2009-03-09 Thread vishwajeet singh
Dear All, I have created an excel addin in python; everything is working pretty fine when I execute the python file, addin is getting added and I am able to use it fine. But I want to distribute this addin to users so I used py2exe to convert it in to an exe so far so good I am able to create exe

Re: [Tutor] problem with an anagram program

2009-03-09 Thread Alan Gauld
"jessica cruz" wrote I just started learning python an I'm currently working on this program. The purpose of this program is to read a string of letters from user input and print out all the words which are anagrams of the input string. Where you define an anagram to be a word that is in

Re: [Tutor] Long list error

2009-03-09 Thread Alan Gauld
"William Stephens" wrote I was working on a sieve of eratosthenes and ran into an error I don't understand. >>> size = 100 >>> l = [0,1]*(size/2) OverflowError: cannot fit 'long' into an index-sized integer Is there a type or something that I can do to prevent this error? The prob

Re: [Tutor] probelm pyhton shell doesnt open help please

2009-03-09 Thread Alan Gauld
"mustafa akkoc" wrote it gives this message socket error This used to happen in older versions of IDLE. What version of Python are you using? If possible upgrade to v2.5 or later. If not you probably need to tweak your firewall settings to open a particular port - but I can't recall whic

Re: [Tutor] problem with an anagram program

2009-03-09 Thread Andre Engels
Please next time, if possible, add the complete error message you get. In this case, it tells us that the error is in this line: if sig == wordList[i] You forgot the : at the end of this line (also, the next lines are not indented extra, as they should). On Mon, Mar 9, 2009 at 9:28

Re: [Tutor] UNSUBSCRIPTABLE?

2009-03-09 Thread Alan Gauld
"WM." wrote Well, Mr. Wilkins takes the biscuit. He found where I did not enter a pair of parens.() But do you understand *why* you got the error and what it was telling you? Pyton's error message told you exactly what you had done wrong although you may not have quite understood it. But do

[Tutor] problem with an anagram program

2009-03-09 Thread jessica cruz
I just started learning python an I'm currently working on this program. The purpose of this program is to read a string of letters from user input and print out all the words which are anagrams of the input string. This is what I have and when I try to run the program it says that there is an e