Re: [Tutor] Python coding help

2011-10-09 Thread bob gailer
On 10/8/2011 8:40 PM, Aisha Ali wrote: Hi, My computer science teacher provided optional Python exercises for us as we're learning about Java/Python right now. I decided to learn how to code these because I'm very interested in programming, but I don't know how to start on the problems in thi

Re: [Tutor] urllib2 sslerror

2011-10-09 Thread Johan Geldenhuys
Hi, The connection I am making is not going through a proxy, but directly to the device over https. Like I said in the original post, it works most of the time, but not always and it I can't reproduce the error on-demand. In this line:html_content = return_object.read(), will it read b

Re: [Tutor] vcf_files and strings

2011-10-09 Thread Steven D'Aprano
Anna Olofsson wrote: Hi, I'm a beginner at Python and would really like some help in how to extract information from a vcf file. The attached file consists of a lot of information on mutations, this one though is just 2 rows and 10 columns (the real one has a lot more rows). What do you mean

Re: [Tutor] Help refactoring this code

2011-10-09 Thread Steven D'Aprano
D. Guandalino wrote: Hi, in this class many methods share common code. Given your example, I wouldn't bother refactoring it. There's not enough code in common to matter. -- Steven ___ Tutor maillist - Tutor@python.org To unsubscribe or change s

Re: [Tutor] fake defrag revisited

2011-10-09 Thread R. Alan Monroe
>> I did get a semi-working version, but it was crazy inefficient because >> it regenerated the swap list after every move, and it bombed out with >> a IndexError about half the time. I found that moving a single block >> at a time lacked the aesthetic appeal I was hoping for, so I bagged it >> fo

Re: [Tutor] Help refactoring this code

2011-10-09 Thread Alan Gauld
On 09/10/11 23:41, D. Guandalino wrote: Hi, in this class many methods share common code. class Foo(object): def m1(self): if self.foo: pass # m1 do something elif self.bar: pass # m1 do something else else: pass # m1 do some

[Tutor] Help refactoring this code

2011-10-09 Thread D. Guandalino
Hi, in this class many methods share common code. class Foo(object): def m1(self): if self.foo: pass # m1 do something elif self.bar: pass # m1 do something else else: pass # m1 do something different def m2(self): if sel

[Tutor] Fw: Python coding help

2011-10-09 Thread ALAN GAULD
Forwarding for group Please always use ReplyAll to send stuff to the group as a whole. That way you get more replies! :-) Alan G. - Forwarded Message From: Aisha Ali To: Alan Gauld Sent: Sunday, 9 October, 2011 18:04:16 Subject: Re: [Tutor] Python coding help I just recently start

Re: [Tutor] String switch

2011-10-09 Thread Dave Angel
On 10/09/2011 11:27 AM, Christopher King wrote: I know the method of finding every string, and inserting a swapcase in to the code. Does anyone now a way just to insert code at the top though? P.S. I use python 2.* Would you consider answering the rest of my questions? Since this is obviousl

Re: [Tutor] String switch

2011-10-09 Thread Alan Gauld
On 09/10/11 16:27, Christopher King wrote: I know the method of finding every string, and inserting a swapcase in to the code. Does anyone now a way just to insert code at the top though? Inserting code at the top of the file is just like inserting any kind of text at the top of any kind of te

Re: [Tutor] vcf_files and strings

2011-10-09 Thread Anna Olofsson
Hi, I still don't know how to make a loop that makes it work for all the mutations. Best, Anna Date: Fri, 7 Oct 2011 13:17:07 -0700 From: ilhs...@yahoo.com Subject: Re: [Tutor] vcf_files and strings To: olofsson_anna...@hotmail.com; tutor@python.org if col[x] == 'missense':print col[withR

Re: [Tutor] String switch

2011-10-09 Thread Christopher King
I know the method of finding every string, and inserting a swapcase in to the code. Does anyone now a way just to insert code at the top though? P.S. I use python 2.* ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

Re: [Tutor] a quick Q: how to use for loop to read a series of files with .doc end

2011-10-09 Thread lina
Just wanna say a quick thanks to all of you here, Very informative. Thanks, On Sun, Oct 9, 2011 at 11:08 AM, Steven D'Aprano wrote: > Walter Prins wrote: > > As for the compiler/interpreter argument, I'll just point out again that >> actually Python in its various forms can either be compiled

Re: [Tutor] Python coding help

2011-10-09 Thread Alan Gauld
On 09/10/11 01:40, Aisha Ali wrote: My computer science teacher provided optional Python exercises for us as we're learning about Java/Python right now. I decided to learn how to code these because I'm very interested in programming, but I don't know how to start on the problems in this case. He

Re: [Tutor] Python coding help

2011-10-09 Thread delegbede
Try a byte of a python or alan gauld site on learning python. Welcome to python. Sent from my BlackBerry wireless device from MTN -Original Message- From: Aisha Ali Sender: tutor-bounces+delegbede=dudupay@python.org Date: Sat, 8 Oct 2011 17:40:38 To: tutor@python.org Reply-To: Ais

[Tutor] Python coding help

2011-10-09 Thread Aisha Ali
Hi, My computer science teacher provided optional Python exercises for us as we're learning about Java/Python right now. I decided to learn how to code these because I'm very interested in programming, but I don't know how to start on the problems in this case. Help? I'll love to learn more abo

Re: [Tutor] Crazy craps problem

2011-10-09 Thread col speed
<--> snip >> if point(one+two) == "win": >> > > Here you go into the function "point" the first time. Inside the function > you are in an infinite while-loop where you only exit if the sum is either 7 > ("lose") or equal the given parameter ("win"). Then you compare the return > value. In