Re: [Tutor] ASCII

2006-03-29 Thread Kaushal Shriyan
On 3/29/06, Pujo Aji <[EMAIL PROTECTED]> wrote: > > Hi Kaushal, > > Please clarify the problem more specific. > Or you can tell us that you have a problem and want to use python to solve > it? > > Sincerely Yours, > pujo > > > On 3/29/06, Kaushal Shriyan <[EMAIL PROTECTED]> wrote: > > > Hi All > >

[Tutor] number of nodes

2006-03-29 Thread kakada
Hello everyone, textp = xmldoc.getElementsByTagName('text:p') from the example above, How can I know how many node are there? Thanks, da ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] ASCII

2006-03-29 Thread Pujo Aji
Hello,Basicaly, You use ASCII or Unicode when you have to deal with character conversion for example coding with a different language symbol, chinese letter etc. Sincerely Yours,Pujo On 3/29/06, Kaushal Shriyan <[EMAIL PROTECTED]> wrote: On 3/29/06, Pujo Aji <[EMAIL PROTECTED]> wrote:>> Hi Kaushal,

Re: [Tutor] Python tutor

2006-03-29 Thread Noufal Ibrahim
On Wed, March 29, 2006 4:35 am, Anna Ravenscroft wrote: > There are several of us on the edupython list who want something like this > but it hasn't (to my knowledge) been created yet. The best things out > there > so far, are livewires, guido von robot, and rur-ple. If you're > interested > in

Re: [Tutor] removing file from zip archive.

2006-03-29 Thread Tim Golden
| How can we remove one file inside of a zip archive? | | I'm using this method: | | import zipfile | | ziparchive = zipfile.ZipFile('test.odt', 'r') | xmldata = ziparchive.read('content.xml') | ziparchive.close (Warning: not my area of expertise, but...) Your example

Re: [Tutor] removing file from zip archive.

2006-03-29 Thread Keo Sophon
On Wednesday 29 March 2006 15:38, Tim Golden wrote: > | How can we remove one file inside of a zip archive? > | > | I'm using this method: > | > | import zipfile > | > | ziparchive = zipfile.ZipFile('test.odt', 'r') > | xmldata = ziparchive.read('content.xml') > | ziparchive.close >

[Tutor] Python Code

2006-03-29 Thread Kaushal Shriyan
Hi I am unable to execute the below code, I have put this in test.py file and made it executable, when I run this I see no output, Please explain me as what is exactly going on with the below code The below code is from http://www.ibiblio.org/obp/thinkCSpy/chap11.htm def copyFile(oldFile, newFil

Re: [Tutor] Python Code

2006-03-29 Thread Noufal Ibrahim
On Wed, March 29, 2006 2:50 pm, Kaushal Shriyan wrote: > Hi > > I am unable to execute the below code, I have put this in test.py file > and made it executable, when I run this I see no output, Please > explain me as what is exactly going on with the below code > > The below code is from http://ww

Re: [Tutor] newbie exercises

2006-03-29 Thread Keo Sophon
On Monday 27 March 2006 19:53, Steve Nelson wrote: > On 3/27/06, josip <[EMAIL PROTECTED]> wrote: > > Can someone give me exercises to do with loops, maybe functions to? > > How about a program that produces truth tables for the basic gates? > AND, NAND, NOT, OR, XOR? > > You could write a function

Re: [Tutor] newbie exercises

2006-03-29 Thread Steve Nelson
On 3/29/06, Keo Sophon <[EMAIL PROTECTED]> wrote: > Is it bitwise operator? Could you give one example? >>> for a in range(2): ... for b in range(2): ... print a, b, a&b ... 0 0 0 0 1 0 1 0 0 1 1 1 > Sophon S. ___ Tutor maillist - Tu

Re: [Tutor] Alternating patterns

2006-03-29 Thread Kent Johnson
kevin parks wrote: >>From: Kent Johnson <[EMAIL PROTECTED]> >>itertools.cycle() will repeat a sequence indefinitely: >>In [2]: from itertools import cycle >> >>In [3]: i=cycle([1,2]) >> >>In [5]: for j in range(6): >>...: print i.next() >>...: >>...: >>1 >>2 >>1 >>2 >>1 >>2 >> >>For

[Tutor] How does it function

2006-03-29 Thread Kaushal Shriyan
Hi ALL Just wanted to know the detailed explanation about the below statement if __name__ == "__main__": Thanks Regards Kaushal ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] How does it function

2006-03-29 Thread Steve Nelson
On 3/29/06, Kaushal Shriyan <[EMAIL PROTECTED]> wrote: > Hi ALL > > Just wanted to know the detailed explanation about the below statement > > if __name__ == "__main__": Simple answer - any python program you write is effectively a 'module'. Modules have an attribute __name__. If you've imported

Re: [Tutor] Program for outputing the letter backward - almost there!

2006-03-29 Thread Hoffmann
--- John Fouhy <[EMAIL PROTECTED]> wrote: > On 29/03/06, Hoffmann <[EMAIL PROTECTED]> wrote: > > Hi John, > > > > (1) vehicle[index] is: 'c' > > (2) If index = index = 1, so vehicle[index] > becomes: > > 'a' > > What I'm getting at here is that, by changing index, > we can change > which letter w

[Tutor] newbie question about default arguments

2006-03-29 Thread Josh Adams
Hi all, I was going through the tutorial at http://docs.python.org/tut/node6.html when I came to the bit about default arguments with this code: def f(a, L=[]): L.append(a) return L print f(1) print f(2) print f(3) returns: [1] [1, 2] [1, 2, 3] >From the postings here, I think I underst

Re: [Tutor] newbie question about default arguments

2006-03-29 Thread Pujo Aji
Hello Josh,you wrote a different problem. The tutorial should be like this: Important warning: The default value is evaluated only once. This makes a difference when the default is a mutable object such as a list, dictionary, or instances of most classes. For example, the following function accum

Re: [Tutor] newbie question about default arguments

2006-03-29 Thread Josh Adams
Thanks for your help. That makes a lot more sense. Not to ask too many stupid questions, but why does the L2 assignment in the if-block create a new L variable? Shouldn't the scope from the function definition dominate the inner scope of the if-block? Thanks, Josh > Josh, > > If you print t

Re: [Tutor] get a character of an ascii-value

2006-03-29 Thread Hugo González Monteverde
Hi, Python strings are binary strings as they can contain any value, including 0 (NULL) Depending on the encoding of the string, this may or may not be printable, and characters over ASCII 127 will mean different letters and symbols. Check the docs for strings and encodings: http://docs.pytho

Re: [Tutor] newbie question about default arguments

2006-03-29 Thread Kent Johnson
Josh Adams wrote: > Thanks for your help. That makes a lot more sense. > > Not to ask too many stupid questions, but why does the L2 assignment in the > if-block create a new L variable? Shouldn't the scope from the function > definition dominate the inner scope of the if-block? It doesn't cr

[Tutor] for loops and exceptions

2006-03-29 Thread Matthew White
Hello, >From a general style and/or programmatic perspective, which is a "better" way to write this bit of code? try: (dn, attrs) = conn.search_s(search_base, search_scope, search_filter, search_attrs): except Exception, e: warn_the_user(e) do_something_useful() for (name, d

Re: [Tutor] Program for outputing the letter backward - almost there!

2006-03-29 Thread Adam
I just wanted to throw in a couple of ideas for you on this subject. These are the ways I would personally think of going about this problem: >>> ''.join([s[n] for n in range(len(s)-1, -1, -1)]) 'rac' Which looks a bit fugly but is nice and short if you can manage list comps. and now my favourite

[Tutor] Automating web page parsing

2006-03-29 Thread Srinivas Iyyer
Dear group, ***Disclaimer***Not suitable for BioPython list*** I work with GeneChips to analyze human gene expression patterns. These genechips are various kinds one of the variety is made at Stanford University. In a typical experiment, an experimenter uses roughly over 40 chips. For a third

[Tutor] Newbie: Passing variable into re.compile

2006-03-29 Thread Jerome Jabson
Hello, I’m having trouble trying to pass a variable into re.compile(), using the “r” option. Let’s say I have the following: import re arg1 = ‘10” p = re.compile(r + arg1 + '\.(\d+\.\d+\.\d+)') This works if I do: p = re.compile(r ‘10\.(\d+\.\d+\.\d+)') Is there

Re: [Tutor] Newbie: Passing variable into re.compile

2006-03-29 Thread John Fouhy
On 30/03/06, Jerome Jabson <[EMAIL PROTECTED]> wrote: > import re > > arg1 = '10" > > p = re.compile(r + arg1 + '\.(\d+\.\d+\.\d+)') Have a look at string substitutions :-) --- http://docs.python.org/lib/typesseq-strings.html p = re.compile(r'%s\.(\d+\.\d+\.\d+)' % arg1) -- John. __

Re: [Tutor] Program for outputing the letter backward - almost there!

2006-03-29 Thread Hoffmann
--- Adam <[EMAIL PROTECTED]> wrote: > I just wanted to throw in a couple of ideas for you > on this subject. > These are the ways I would personally think of going > about this > problem: > > >>> ''.join([s[n] for n in range(len(s)-1, -1, -1)]) > 'rac' > Which looks a bit fugly but is nice and sh

Re: [Tutor] Newbie: Passing variable into re.compile

2006-03-29 Thread Kent Johnson
Jerome Jabson wrote: > Hello, > > > > I’m having trouble trying to pass a variable into > re.compile(), using the “r” option. Let’s say I > have the following: > > > > import re > > arg1 = ‘10” > > p = re.compile(r + arg1 + '\.(\d+\.\d+\.\d+)') > > > > This works if I do: > > > >

Re: [Tutor] Automating web page parsing

2006-03-29 Thread Kent Johnson
Srinivas Iyyer wrote: > For a third party to analyze data from that chip, we > should know the design of that chip and that > information is one file. In this case it is GAL file. > Since it is difficult and cumbersome to identify each > design file type of all chips and get it into your > directo

Re: [Tutor] Program for outputing the letter backward - almost there!

2006-03-29 Thread Adam
> Hi John, > > We are almost there. I changed the code and, at least, > I got the correct output. However, I also got a > traceback. I didn't understand the traceback. Could > you clarify that? > Thanks, > Hoffmann > ps: The new code: > > >>> vehicle='car' > >>> index = -1 #index of the last lette

Re: [Tutor] Program for outputing the letter backward - almost there!

2006-03-29 Thread Kent Johnson
Hoffmann wrote: > We are almost there. I changed the code and, at least, > I got the correct output. However, I also got a > traceback. I didn't understand the traceback. Could > you clarify that? > Thanks, > Hoffmann > ps: The new code: > > vehicle='car' index = -1 #index of the last le

Re: [Tutor] get a character of an ascii-value

2006-03-29 Thread Keo Sophon
On Thursday 30 March 2006 01:25, Hugo González Monteverde wrote: > Hi, > > Python strings are binary strings as they can contain any value, > including 0 (NULL) Depending on the encoding of the string, this may or > may not be printable, and characters over ASCII 127 will mean different > letters a

Re: [Tutor] How does it function

2006-03-29 Thread Terry Carroll
On Wed, 29 Mar 2006, Steve Nelson wrote: > On 3/29/06, Kaushal Shriyan <[EMAIL PROTECTED]> wrote: > > > > Just wanted to know the detailed explanation about the below statement > > > > if __name__ == "__main__": > > Simple answer - any python program you write is effectively a > 'module'. Modules

Re: [Tutor] Program for outputing the letter backward

2006-03-29 Thread Hoffmann
--- Kent Johnson <[EMAIL PROTECTED]> wrote: > Hoffmann wrote: > > We are almost there. I changed the code and, at > least, > > I got the correct output. However, I also got a > > traceback. I didn't understand the traceback. > Could > > you clarify that? > > Thanks, > > Hoffmann > > ps: The new co

[Tutor] Beginner can't finish code

2006-03-29 Thread Tamaryn Sarusi-Kiss
Hi,     I'm a beginner and can't finish the code I'm working on below. I want the code below to have "hints" when the user asks for them , and I don't know enough to do this.What would be the best way of introducing "hints" and allowing the user to exit when he wants to. Any help would  be ap

Re: [Tutor] Automating web page parsing

2006-03-29 Thread Bob Gailer
Srinivas Iyyer wrote: > Dear group, > > ***Disclaimer***Not suitable for BioPython list*** > > I work with GeneChips to analyze human gene expression > patterns. These genechips are various kinds one of the > variety is made at Stanford University. In a typical > experiment, an experimenter uses r