[Tutor] arrary stastic

lina lina.lastname at gmail.com
Tue Oct 4 16:07:10 CEST 2011


On Tue, Oct 4, 2011 at 10:03 PM, lina <lina.lastname at gmail.com> wrote:

>
>
> On Tue, Oct 4, 2011 at 8:51 PM, <eire1130 at gmail.com> wrote:
>
>> I don't understand what you want
>>
>> Mayybe give expected output as well
>>
>
> want to do a statistic of the concurrence of E,
> namely,
> how many times the E showed up,
>
> so the first column is 1, second column and then following.
>
> Thanks,
>
> I have one, which showed something like:
>
>
>
> tokens=['E']
>
> result=[]
> filedata = open("try.xpm")
> text=filedata.readlines()
>
> for line in text:
>     result.append({t:line.count(t) for t in tokens})
>
> for index,r in enumerate(result):
>     print(index,"-----",r)
>
> The error message is:
>
>
>     result.append({t:line.count(t) for t in tokens})
>                                      ^
> SyntaxError: invalid syntax
>
I made a mistake, it used python3

I wonder: can someone help me anatomy this one to help me understand,


>
>
>
>>
>> Sent from my Verizon Wireless BlackBerry
>>
>> -----Original Message-----
>> From: lina <lina.lastname at gmail.com>
>> Sender: tutor-bounces+eire1130=gmail.com at python.org
>> Date: Tue, 4 Oct 2011 19:44:02
>> To: tutor<Tutor at python.org>
>> Subject: [Tutor] arrary stastic
>>
>> _______________________________________________
>> Tutor maillist  -  Tutor at python.org
>> To unsubscribe or change subscription options:
>> http://mail.python.org/mailman/listinfo/tutor
>>
>>
>>
>
>
> --
> Best Regards,
>
> lina
>
>
>


-- 
Best Regards,

lina
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20111004/fce87d50/attachment.html>


More information about the Tutor mailing list