Re: [Tutor] a few question about my evolving program

2015-08-11 Thread Mark Lawrence
On 12/08/2015 06:33, Clayton Kirkwood wrote: I understand what you are saying. However, you guys are constantly asking for the original code. Now you are saying you are saying not the original code, rather a made up snippet, which very likely, for newbies like me, would bet bungled in creating a

Re: [Tutor] a few question about my evolving program

2015-08-11 Thread Clayton Kirkwood
> -Original Message- > From: Cameron Simpson [mailto:c...@zip.com.au] > Sent: Tuesday, August 11, 2015 8:46 PM > To: Clayton Kirkwood > Cc: tutor@python.org > Subject: Re: [Tutor] a few question about my evolving program > > On 11Aug2015 20:23, Clayton Kirkwood wrote: > >Question 1: >

Re: [Tutor] a few question about my evolving program

2015-08-11 Thread Cameron Simpson
On 11Aug2015 20:23, Clayton Kirkwood wrote: Question 1: What is the purpose and how is the following definition focused on the *? Turns out, you can't actually put the asterisk in the code, so what does it mean? os.stat(path, *, dir_fd=None, follow_symlinks=True) It is generally better to make

Re: [Tutor] AttributeError,

2015-08-11 Thread Steven D'Aprano
On Tue, Aug 11, 2015 at 07:38:21PM -0700, Ltc Hotspot wrote: > Steven, > > Visit the URL links below to view the latest revised code: I don't think so. I don't have access to the web right now, but I do have access to email. And even if I did, I'm lazy and wouldn't follow links and then have to

[Tutor] a few question about my evolving program

2015-08-11 Thread Clayton Kirkwood
Question 1: What is the purpose and how is the following definition focused on the *? Turns out, you can't actually put the asterisk in the code, so what does it mean? os.stat(path, *, dir_fd=None, follow_symlinks=True) Question 2: My current code: See "Look here" below. #Program to find duplicat

Re: [Tutor] AttributeError,

2015-08-11 Thread Mark Lawrence
On 12/08/2015 03:01, Steven D'Aprano wrote: On Tue, Aug 11, 2015 at 04:24:39PM -0700, Ltc Hotspot wrote: Hi Everyone, Why is there an AttributeError, line 12, below : 'tuple' object has no attribute 'sort'? Haven't I see this exact same question, complete with solutions, on the python-list ma

Re: [Tutor] AttributeError,

2015-08-11 Thread Steven D'Aprano
On Tue, Aug 11, 2015 at 04:24:39PM -0700, Ltc Hotspot wrote: > Hi Everyone, > > Why is there an AttributeError, line 12, below : 'tuple' object has no > attribute 'sort'? Haven't I see this exact same question, complete with solutions, on the python-list mailing list? The answer found there is

Re: [Tutor] Writing back to same CSV in the next column

2015-08-11 Thread Alan Gauld
On 12/08/15 01:58, Nym City wrote: > Please find the two requested files attached. Since this is a text mailing list it's better to insert the files into the email. Many servers will strip out attachments so they can't be seen. I've pasted them below. Before: 10.0.0.1 10.0.0.2 10.0.0.3 10.0.0.

Re: [Tutor] AttributeError,

2015-08-11 Thread Alan Gauld
On 12/08/15 00:24, Ltc Hotspot wrote: Why is there an AttributeError, line 12, below : 'tuple' object has no attribute 'sort'? Having answered that in my last email I just noticed another problem... count = dict() fname = raw_input("Enter file name: ")# handle = open (fname, 'r')# for line i

Re: [Tutor] AttributeError,

2015-08-11 Thread Alan Gauld
On 12/08/15 00:24, Ltc Hotspot wrote: Why is there an AttributeError, line 12, below : 'tuple' object has no attribute 'sort'? Because a tuple has no attribute sort. A tuple is immutable - you can't change it. Therefore, you can't sort it. You can however use the sorted() function on it to re

[Tutor] AttributeError,

2015-08-11 Thread Ltc Hotspot
Hi Everyone, Why is there an AttributeError, line 12, below : 'tuple' object has no attribute 'sort'? count = dict() fname = raw_input("Enter file name: ")# handle = open (fname, 'r')# for line in handle: if line.startswith("From "): address = line.split()[5] line = line.rstri

Re: [Tutor] Need advise on protein sequence alignment code in python 2.7 giving wrong output

2015-08-11 Thread Mark Lawrence
On 11/08/2015 22:16, Alan Gauld wrote: On 11/08/15 22:09, Mark Lawrence wrote: On 11/08/2015 19:54, Laura Creighton wrote: You posted incomplete code -- at any rate I cannot get it to work. Having taken a closer look how can it work when range() and xrange() are both used? OK, I'll bite. W

Re: [Tutor] Need advise on protein sequence alignment code in python 2.7 giving wrong output

2015-08-11 Thread Alan Gauld
On 11/08/15 22:09, Mark Lawrence wrote: On 11/08/2015 19:54, Laura Creighton wrote: You posted incomplete code -- at any rate I cannot get it to work. Having taken a closer look how can it work when range() and xrange() are both used? OK, I'll bite. Why is that a problem? It's not conventio

Re: [Tutor] Need advise on protein sequence alignment code in python 2.7 giving wrong output

2015-08-11 Thread Mark Lawrence
On 11/08/2015 19:54, Laura Creighton wrote: You posted incomplete code -- at any rate I cannot get it to work. Having taken a closer look how can it work when range() and xrange() are both used? -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for our

Re: [Tutor] Need advise on protein sequence alignment code in python 2.7 giving wrong output

2015-08-11 Thread Laura Creighton
I wrote: >>> nwalign.global_align("PLEASANTLY", "MEANLY", gap_open=-5, gap_extend=-5, matrix='./BLOSUM62.txt') >>> ('PLEASANTLY', '-MEA--N-LY') I forgot to mention that I got my BLOSUM62.txt from http://www.ncbi.nlm.nih.gov/Class/FieldGuide/BLOSUM62.txt in case that matters. Laur

Re: [Tutor] Need advise on protein sequence alignment code in python 2.7 giving wrong output

2015-08-11 Thread Laura Creighton
You posted incomplete code -- at any rate I cannot get it to work. However, I think the problem is here: for i in xrange(len(v)): for j in xrange(len(w)): if max(S[i][j-1],S[i-1][j],S[i-1][j-1]) == S[i-1][j]: When j is 0, j-1 refers to the end of the list, which makes no

Re: [Tutor] Need advise on protein sequence alignment code in python 2.7 giving wrong output

2015-08-11 Thread Mark Lawrence
On 11/08/2015 09:53, Белякова Анастасия wrote: I am trying to develop code to perform global sequence alignment in python 2.7 for proteins with gap penalty of -5 and blossom64 scoring matrix. Code I have now give wrong output. Will BioPython fit your needs? http://biopython.org/wiki/Main_Page

Re: [Tutor] generate random number list and search for number

2015-08-11 Thread Steven D'Aprano
Hi Stephanie, My comments below, interleaved between yours. On Tue, Aug 11, 2015 at 03:18:59AM +, Quiles, Stephanie wrote: > Here is the thing I am totally lost. Here is what i have so far… i > created the main function and i ask the user to search for a number. You're not totally lost! On

Re: [Tutor] Refresh library imported

2015-08-11 Thread Laura Creighton
In a message of Tue, 11 Aug 2015 10:29:56 +0200, jarod_v6--- via Tutor writes: >HI there!! >I try to develop some scripts. I use ipython for check if my script work. > >When I change the script and try to import again that script I'm not able to >see the modification so I need every time close

Re: [Tutor] Need advise on protein sequence alignment code in python 2.7 giving wrong output

2015-08-11 Thread Alan Gauld
On 11/08/15 09:53, Белякова Анастасия wrote: I am trying to develop code to perform global sequence alignment in python 2.7 for proteins with gap penalty of -5 and blossom64 scoring matrix. Code I have now give wrong output. This list is for folks learning the Python language and standard libra

Re: [Tutor] Refresh library imported

2015-08-11 Thread Steven D'Aprano
On Tue, Aug 11, 2015 at 10:29:56AM +0200, jarod_v6--- via Tutor wrote: > HI there!! > I try to develop some scripts. I use ipython for check if my script work. > > When I change the script and try to import again that script I'm not > able to see the modification so I need every time close ipyth

[Tutor] Need advise on protein sequence alignment code in python 2.7 giving wrong output

2015-08-11 Thread Белякова Анастасия
I am trying to develop code to perform global sequence alignment in python 2.7 for proteins with gap penalty of -5 and blossom64 scoring matrix. Code I have now give wrong output. When I give 'PLEASANTLY' and 'MEANLY' as input, I get 'PLEASANTLY' and 'M-EAN--L-Y' as output instead of 'PLEASANTLY'

[Tutor] Refresh library imported

2015-08-11 Thread jarod_v6--- via Tutor
HI there!! I try to develop some scripts. I use ipython for check if my script work. When I change the script and try to import again that script I'm not able to see the modification so I need every time close ipython and run again and import the script. How can do the refresh of library wit

Re: [Tutor] generate random number list and search for number

2015-08-11 Thread Alan Gauld
On 11/08/15 04:18, Quiles, Stephanie wrote: Totally lost here. Most of the instructions are clearly listed. Just follow through and do what it suggests one step at a time. • First, we’ll need to import time to use the clock routine, So import time and we’ll need to use the randra

Re: [Tutor] Writing back to same CSV in the next column

2015-08-11 Thread Alan Gauld
On 11/08/15 01:23, Nym City via Tutor wrote: import socket import csv ListOfIPAddresses = [] with open('top500ips.csv', 'rb') as f: for line in f: line = line.strip() ListOfIPAddresses.append(line) f.close() You don;t need the f.close(). The 'with' structiure does that

[Tutor] generate random number list and search for number

2015-08-11 Thread Quiles, Stephanie
Hello everyone, Totally lost here. i have to create a program that asks user to input a value and then search for this value in a random list of values to see if it is found. Please see below for more detailed info. This problem requires you to use Python. We want to test out the ordered sequ

Re: [Tutor] Writing back to same CSV in the next column

2015-08-11 Thread Nym City via Tutor
Hello, Wanted to write back to see if anyone  had the chance to review my previous request. import socket import csv ListOfIPAddresses = [] with open('top500ips.csv', 'rb') as f:     for line in f:     line = line.strip()     ListOfIPAddresses.append(line) f.close() # print(ListOfIPAd