lina wrote:
> On Wed, Nov 2, 2011 at 12:14 AM, Peter Otten <__pete...@web.de> wrote:
>> lina wrote:
>>
sorted(new_dictionary.items())
>>>
>>> Thanks, it works, but there is still a minor question,
>>>
>>> can I sort based on the general numerical value?
>>>
>>> namely not:
>>> :
>>> :
>>> 83I
Not sure if that is what you are after since you are calling
re.split() using items when Peter was using re.split() on a single
item within items
so instead of this
parts = re.split(r"(\d+)", str(items))
try specifying just one item, like this
parts = re.split(r"(\d+)", items[0])
On Fri, Nov 4, 2
On 11/03/2011 10:39 PM, lina wrote:
On Wed, Nov 2, 2011 at 12:14 AM, Peter Otten<__pete...@web.de> wrote:
lina wrote:
items
[('83ILE', 1), ('84ALA', 2), ('8SER', 0), ('9GLY', 0)]
parts = re.split(r"(\d+)",items)
Traceback (most recent call last):
File "", line 1, in
parts = re.s
On Fri, Nov 4, 2011 at 10:39 AM, lina wrote:
> On Wed, Nov 2, 2011 at 12:14 AM, Peter Otten <__pete...@web.de> wrote:
>> lina wrote:
>>
sorted(new_dictionary.items())
>>>
>>> Thanks, it works, but there is still a minor question,
>>>
>>> can I sort based on the general numerical value?
>>>
>>
On Wed, Nov 2, 2011 at 12:14 AM, Peter Otten <__pete...@web.de> wrote:
> lina wrote:
>
>>> sorted(new_dictionary.items())
>>
>> Thanks, it works, but there is still a minor question,
>>
>> can I sort based on the general numerical value?
>>
>> namely not:
>> :
>> :
>> 83ILE 1
>> 84ALA 2
>> 8SER 0
>
On 02/11/11 16:58, Dave Angel wrote:
sorted(results)
['10B', '1A', '2C', '3D']
as [ '1A', '2C', '3D','10B']
Essence of the answer is you can supply a key=myfunc argument to
sorted(). Then it's up to you what you put in that function. It sounds
like you want to convert any leading digits to
On 11/02/2011 11:54 AM, lina wrote:
Regard the sorted(),
I still have a question,
how to sort something like
results
['1A', '10B', '2C', '3D']
sorted(results)
['10B', '1A', '2C', '3D']
as [ '1A', '2C', '3D','10B']
Thanks,
mainly based on their digital value.
Peter answered essential
Regard the sorted(),
I still have a question,
how to sort something like
>>> results
['1A', '10B', '2C', '3D']
>>> sorted(results)
['10B', '1A', '2C', '3D']
as [ '1A', '2C', '3D','10B']
Thanks,
mainly based on their digital value.
___
Tutor maill
On Tue, Nov 1, 2011 at 11:56 PM, Dave Angel wrote:
> On 11/01/2011 11:11 AM, lina wrote:
>>
>> On Tue, Nov 1, 2011 at 10:33 PM, Dave Angel wrote:
>>>
>>> On 11/01/2011 10:11 AM, lina wrote:
Hi,
The following code (luckily) partial achieved what I wanted, but I
still have
On 01/11/11 14:33, Dave Angel wrote:
Just use the sort() method of the list object. In particular, items()
returns an unordered list, so it's ready to be sorted.
for residues, numbers in new_dictionary.items().sort():
I don't think this would work since sort works in place. You would need
to
lina wrote:
>> sorted(new_dictionary.items())
>
> Thanks, it works, but there is still a minor question,
>
> can I sort based on the general numerical value?
>
> namely not:
> :
> :
> 83ILE 1
> 84ALA 2
> 8SER 0
> 9GLY 0
> :
> :
>
> rather 8 9 ...83 84,
>
> Thanks,
You need a custom key funct
On 11/01/2011 11:11 AM, lina wrote:
On Tue, Nov 1, 2011 at 10:33 PM, Dave Angel wrote:
On 11/01/2011 10:11 AM, lina wrote:
Hi,
The following code (luckily) partial achieved what I wanted, but I
still have few questions:
#!/usr/bin/python3
import os.path
INFILEEXT=".txt"
OUTFILEEXT=".new"
On 11/01/2011 11:11 AM, lina wrote:
On Tue, Nov 1, 2011 at 10:33 PM, Dave Angel wrote:
On 11/01/2011 10:11 AM, lina wrote:
Hi,
The following code (luckily) partial achieved what I wanted, but I
still have few questions:
#!/usr/bin/python3
import os.path
INFILEEXT=".txt"
OUTFILEEXT=".new"
On Tue, Nov 1, 2011 at 11:28 PM, Peter Otten <__pete...@web.de> wrote:
> lina wrote:
>
>> On Tue, Nov 1, 2011 at 10:33 PM, Dave Angel wrote:
>>> On 11/01/2011 10:11 AM, lina wrote:
>
>>> Just use the sort() method of the list object. In particular, items()
>>> returns an unordered list, so it's r
lina wrote:
> On Tue, Nov 1, 2011 at 10:33 PM, Dave Angel wrote:
>> On 11/01/2011 10:11 AM, lina wrote:
>> Just use the sort() method of the list object. In particular, items()
>> returns an unordered list, so it's ready to be sorted.
>>
>> for residues, numbers in new_dictionary.items().sort()
On Tue, Nov 1, 2011 at 10:33 PM, Dave Angel wrote:
> On 11/01/2011 10:11 AM, lina wrote:
>>
>> Hi,
>>
>> The following code (luckily) partial achieved what I wanted, but I
>> still have few questions:
>>
>>
>> #!/usr/bin/python3
>>
>> import os.path
>>
>> INFILEEXT=".txt"
>> OUTFILEEXT=".new"
>> D
On 11/01/2011 10:11 AM, lina wrote:
Hi,
The following code (luckily) partial achieved what I wanted, but I
still have few questions:
#!/usr/bin/python3
import os.path
INFILEEXT=".txt"
OUTFILEEXT=".new"
DICTIONARYFILE="dictionary.pdb"
orig_dictionary={}
new_dictionary={}
abetaABresidues={}
d
Hi,
The following code (luckily) partial achieved what I wanted, but I
still have few questions:
#!/usr/bin/python3
import os.path
INFILEEXT=".txt"
OUTFILEEXT=".new"
DICTIONARYFILE="dictionary.pdb"
orig_dictionary={}
new_dictionary={}
abetaABresidues={}
def processonefiledata(infilename):
18 matches
Mail list logo