[Tutor] arrary stastic

lina lina.lastname at gmail.com
Tue Oct 4 16:03:35 CEST 2011


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



>
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20111004/e4347892/attachment.html>


More information about the Tutor mailing list