Re: [Tutor] Converting from a single module to a package

2011-08-06 Thread Timo
On 06-08-11 01:38, Emile van Sebille wrote: On 8/5/2011 4:22 PM Tim Johnson said... * Christopher King [110805 12:03]: To make a package, you make a folder named what you want to name the package, for example: virus_toolkit. Then you make a file in it called __init__.py. This is what you impor

[Tutor] adding dictionary value at position [-1]

2011-08-06 Thread Norman Khine
hello, i know that there are no indexes/positions in a python dictionary, what will be the most appropriate way to do this: addresses = {} for result in results.get_documents(): addresses[result.name] = result.title # we add a cre

Re: [Tutor] adding dictionary value at position [-1]

2011-08-06 Thread Rafael Durán Castañeda
Resending to list, since I click reply instead of reply to list, I'm sorry Norman since you are receiving twice: If you need an order item, use a list, so you can use a dictionary containing an ordered list of dictionaries. I think you want do somthing like this: import json addresses = {} a

Re: [Tutor] adding dictionary value at position [-1]

2011-08-06 Thread Dave Angel
On 08/06/2011 07:32 AM, Norman Khine wrote: hello, i know that there are no indexes/positions in a python dictionary, what will be the most appropriate way to do this: addresses = {} for result in results.get_documents(): addresses[result.na

Re: [Tutor] adding dictionary value at position [-1]

2011-08-06 Thread Norman Khine
hello, thanks for the replies On Sat, Aug 6, 2011 at 2:07 PM, Dave Angel wrote: > On 08/06/2011 07:32 AM, Norman Khine wrote: >> >> hello, >> i know that there are no indexes/positions in a python dictionary, >> what will be the most appropriate way to do this: >> >>                 addresses = {

[Tutor] Basic web form interaction with http://propka.ki.ku.dk/

2011-08-06 Thread Troels Emtekær Linnet
Dear Python users. I am an semi-experienced in python, but totally new on the web interactions. I have been working with scripts to the protein program Pymol, which can be extended with python script. I hope that some of you can help me with an interaction script to http://propka.ki.ku.dk/. I hop

Re: [Tutor] Basic web form interaction with http://propka.ki.ku.dk/

2011-08-06 Thread Mateusz Koryciński
Hi, Have You tried something similar to interface used in BioPython? I think U could get solution by reading code for connection with databases like Entrez. Maybe this will give you some ideas. Do you want your script to download pdb file from PDB database? Or you want only sending and receiving

Re: [Tutor] Basic web form interaction with http://propka.ki.ku.dk/

2011-08-06 Thread Troels Emtekær Linnet
Hi Mateus. No, I was certainly not aware of BioPython. What a nice project. I will check it out. No, the script should not download a .pdb file. The idea is, that a "researcher/student" sits with his/hers favorite protein in pymol and would like to know the pKa value of his/hers favorite amino ac

Re: [Tutor] Basic web form interaction with http://propka.ki.ku.dk/

2011-08-06 Thread Mateusz Koryciński
Hi, IMHO, first of all you should check if server admins allow automatic connection outside web browser. Maybe they do and there a simple way to connect and they will tell you how (for example how query should look like as a command for software installed on server). I just check and they have lin

Re: [Tutor] adding dictionary value at position [-1]

2011-08-06 Thread Alan Gauld
On 06/08/11 12:32, Norman Khine wrote: hello, i know that there are no indexes/positions in a python dictionary, what will be the most appropriate way to do this: addresses = {} for result in results.get_documents(): addresses[result.name] =

Re: [Tutor] adding dictionary value at position [-1]

2011-08-06 Thread Peter Otten
Alan Gauld wrote: > On 06/08/11 12:32, Norman Khine wrote: >> hello, >> i know that there are no indexes/positions in a python dictionary, >> what will be the most appropriate way to do this: >> >> addresses = {} >> for result in results.get_documents(): >>

Re: [Tutor] [Python-ideas] Access to function objects

2011-08-06 Thread Christopher King
On Sat, Aug 6, 2011 at 4:10 AM, David Townshend wrote: > > def counter(add) as func: > if not hasattr(func, 'count'): > func.count = 0 > func.count += 1 > print(func.count) > You already can do that without an as statment. >>> def counter(add): if not hasattr(counter, 'coun

[Tutor] gzip

2011-08-06 Thread questions anon
Hi All, I am trying to decompress at gzipped netcdf file and place the decompressed file in the same folder without the *.gz extension. I am using gzip. If I use the following code nothing happens. import gzip filepath="D:/test/surfacetemp.nc.gz" compresseddata=gzip.open(filepath, "rb") file_conte

Re: [Tutor] gzip

2011-08-06 Thread Walter Prins
On 7 August 2011 01:52, questions anon wrote: > How can I output the decompressed file? something like: > output=file_content.write(filepath[:-3]) > > See here: http://docs.python.org/tutorial/inputoutput.html#reading-and-writing-files And here: http://docs.python.org/library/stdtypes.html#file.w

[Tutor] commandline unable to read numbers?

2011-08-06 Thread Robert Sjoblom
I have a quite odd problem, and I've come across it before but probably ignored it at the time because I had other concerns. I've tried googling for the answer but haven't really come closer to solving it. This is what happens: C:\[path]\nester>C:\Python32\python.ex e setup.py register running regi

Re: [Tutor] commandline unable to read numbers?

2011-08-06 Thread Steven D'Aprano
Robert Sjoblom wrote: I have a quite odd problem, and I've come across it before but probably ignored it at the time because I had other concerns. I've tried googling for the answer but haven't really come closer to solving it. This is what happens: C:\[path]\nester>C:\Python32\python.ex e setup.