Re: [Tutor] triple-nested for loop not working

2011-05-05 Thread Andre Engels
I have not checked the rest of your code, but: > for line in seqalign: >     for i in len(finalmotif_seqs):      # for item in finalmotif_seqs: >         for i in len(finalmotif_annot):     # for item in finalmotif_annot: I see two problems here: 1. You are using the same loop variable in both lo

[Tutor] assigning a variable a value

2011-05-05 Thread Kyle Benak
Hi, I am learning python and I am trying to write a simple "guess the number" game. I wrote the program in the IDLE, and I set the variable tries=1 to keep up with the number of tries it takes to guess the number, but when I try to run the program it gives the error message "improper syntax"

Re: [Tutor] assigning a variable a value

2011-05-05 Thread Andre Engels
On Thu, May 5, 2011 at 2:19 AM, Kyle Benak wrote: > I am learning python and I am trying to write a simple "guess the number" > game. I wrote the program in the IDLE, and I set the variable tries=1 to > keep up with the number of tries it takes to guess the number, but when I > try to run the pro

Re: [Tutor] assigning a variable a value

2011-05-05 Thread Alan Gauld
"Kyle Benak" wrote I am learning python and I am trying to write a simple "guess the number" game. I wrote the program in the IDLE, and I set the variable tries=1 to keep up with the number of tries it takes to guess the number, but when I try to run the program it gives the error message "i

Re: [Tutor] Titles from a web page

2011-05-05 Thread Alan Gauld
"louis leichtnam" wrote I'm trying to write a program that looks in a webpage in find the titles of a subsection of the page: Can you help me out? I tried using regular expression but I keep hitting walls and I don't know what to do... Regular expressions are the wrong tool for parsing H

Re: [Tutor] Need help with arrays

2011-05-05 Thread Matt Gregory
On 5/4/2011 10:30 AM, Patrick P. wrote: Hello, I hope this is the right way to ask my question, if not, sorry to bother you. Maybe you can tell me who to ask. Ok so here is my code [snip] A = np.array([[m111,m121], [m211,m221]]) B = np.array([[m112,m122], [m212,m222]]) print(np.dot(A,B)) Trac

Re: [Tutor] Reading elements in a file

2011-05-05 Thread bob gailer
On 5/4/2011 6:59 PM, Alan Gauld wrote: The string methods are builtin and the string module is really only needed for backwatds compatibility these days. Yes, except for: 8.1.5. String functions The following functions are available to operate on string and Unicode objects. They are not avai

Re: [Tutor] Reading elements in a file

2011-05-05 Thread Prasad, Ramit
> string.capwords(s[, sep]) So capwords is a little bit different but you can use a combination of split() and title() to do some of it. Title() will work for the default case, but if you split on non-whitespace then you will need to manually use split(). 'test test test'.title() 'Test Test Test'

[Tutor] dictionary

2011-05-05 Thread louis leichtnam
HEllo everyone, I have a dictionnary, and I would like to print only the values that have more/equal than 3 spaces in them for example: My name is Xavier. Can you help me out, Thanks Louis ___ Tutor maillist - Tutor@python.org To unsubscribe or chan

Re: [Tutor] dictionary

2011-05-05 Thread naheed arafat
Supposing your dictionary like this: dict={1:'My name is X',2:'My name is x y z',3: 'i am X'} You can use len(list) : >>> dict={1:'My name is X',2:'My name is x y z',3: 'i am X'} >>> for values in dict.values(): ... if len(values.split(' '))>3: ...print values My name is X My name is x

Re: [Tutor] dictionary

2011-05-05 Thread Steven D'Aprano
louis leichtnam wrote: HEllo everyone, I have a dictionnary, and I would like to print only the values that have more/equal than 3 spaces in them for example: My name is Xavier. d = {1: "Hello world", 2: "My name is Xavier", 3: "ham and eggs", 4: "Eat more cheese please!", 5: "spam spam