On Mon, Oct 24, 2011 at 3:24 PM, Peter Otten <__pete...@web.de> wrote:
> lina wrote:
>
>> But I am getting confused later:
>>
>> def translate_process(dictionary,tobetranslatedfile):
>> results=[]
>> unique={}
>> for line in open(tobetranslatedfile,"r"):
>> tobetranslatedparts=l
>>
>> def translate_process(dictionary,tobetranslatedfile):
>> results=[]
>> unique={}
>> for line in open(tobetranslatedfile,"r"):
>> tobetranslatedparts=line.strip().split()
>> results.append(dictionary[tobetranslatedparts[2]])
>> unique=Counter(results)
>>
On Mon, Oct 24, 2011 at 3:24 PM, Peter Otten <__pete...@web.de> wrote:
> lina wrote:
>
>> But I am getting confused later:
>>
>> def translate_process(dictionary,tobetranslatedfile):
>> results=[]
>> unique={}
>> for line in open(tobetranslatedfile,"r"):
>> tobetranslatedparts=l
lina wrote:
> But I am getting confused later:
>
> def translate_process(dictionary,tobetranslatedfile):
> results=[]
> unique={}
> for line in open(tobetranslatedfile,"r"):
> tobetranslatedparts=line.strip().split()
> results.append(dictionary[tobetranslatedparts[2]])
On 10/23/2011 08:01 AM, lina wrote:
On Sun, Oct 23, 2011 at 6:06 PM, Peter Otten<__pete...@web.de> wrote:
lina wrote:
tobetranslatedparts=line.strip().split()
strip() is superfluous here, split() will take care of the stripping:
" alpha \tbeta\n".split()
['alpha', 'beta']
for residue in
On Sun, Oct 23, 2011 at 6:06 PM, Peter Otten <__pete...@web.de> wrote:
> lina wrote:
>
tobetranslatedparts=line.strip().split()
>
> strip() is superfluous here, split() will take care of the stripping:
>
" alpha \tbeta\n".split()
> ['alpha', 'beta']
>
for residue in results:
lina wrote:
>>> tobetranslatedparts=line.strip().split()
strip() is superfluous here, split() will take care of the stripping:
>>> " alpha \tbeta\n".split()
['alpha', 'beta']
>>> for residue in results:
>>> if residue not in unique:
>>> unique[residue]=1
>>> else:
>>> un
The updated one -- following Alan's advice.
#!/usr/bin/python3
import os.path
mapping={}
DICTIONARYFILE="dictionary.pdb"
TOBETRANSLATEDFILEEXT=".out"
OUTPUTFILEEXT=".txt"
def generate_dict(dictionarysourcefile):
for line in open(dictionarysourcefile,"r"):
parts=line.strip().split(
On Sun, Oct 23, 2011 at 5:08 PM, Alan Gauld wrote:
> On 23/10/11 09:33, lina wrote:
>
>> I have a further question:
>>
>
>> Welcome anyone help me transform the code to another form.
>
> What form would you like it transformed to?
> A flow chart? Another programming language? A different style of
On 23/10/11 09:33, lina wrote:
I have a further question:
> Welcome anyone help me transform the code to another form.
What form would you like it transformed to?
A flow chart? Another programming language? A different style of Python
(Functional programming or OOP maybe?)
I'm not sure wh
On Sun, Oct 23, 2011 at 12:50 AM, Steven D'Aprano wrote:
> lina wrote:
>>
>> Hi,
>>
>> I googled for a while, but failed to find the perfect answer,
>>
>> for a string
>>
>> ['85CUR', '85CUR']
>
>
> That's not a string, it is a list.
>
>
>> how can I unique it as:
>>
>> ['85CUR']
>
> Your question
On 23 Oct, 2011, at 0:22, Devin Jeanpierre wrote:
> You should be able to do this yourself, with the help of the following link:
>
> http://docs.python.org/library/stdtypes.html#set
Thanks.
>
> Is this a homework question?
No.
>
> Devin
>
> On Sat, Oct 22, 2011 at 12:09 PM, lina wrote:
>
lina wrote:
Hi,
I googled for a while, but failed to find the perfect answer,
for a string
['85CUR', '85CUR']
That's not a string, it is a list.
how can I unique it as:
['85CUR']
Your question is unclear. If you have this:
['85CUR', '99bcd', '85CUR', '85CUR']
what do you expect to g
On 10/22/2011 12:09 PM, lina wrote:
Hi,
I googled for a while, but failed to find the perfect answer,
for a string
['85CUR', '85CUR']
how can I unique it as:
['85CUR']
Try
set(['85CUR', '85CUR']
--
Bob Gailer
919-636-4239
Chapel Hill NC
___
Tu
You should be able to do this yourself, with the help of the following link:
http://docs.python.org/library/stdtypes.html#set
Is this a homework question?
Devin
On Sat, Oct 22, 2011 at 12:09 PM, lina wrote:
> Hi,
>
> I googled for a while, but failed to find the perfect answer,
>
> for a strin
15 matches
Mail list logo