Chris Jones wrote:
> On Fri, Jan 22, 2010 at 05:07:13PM EST, Arnaud Delobelle wrote:
>
> [..]
>
>> import codecs
>> from collections import defaultdict
>>
>> tcounters = defaultdict(int)
>> f = codecs.open('/home/gavron/git/screen/src/screen.c', 'r', "utf-8")
>>
>> for c in f.read():
>> tcoun
On Sat, Jan 23, 2010 at 02:45:41AM EST, Terry Reedy wrote:
> On 1/22/2010 9:58 PM, Chris Jones wrote:
>> Do you mean I should just read the file one character at a time?
>
> Whoops, my misdirection (you can .read(1), but this is s l o w.
> I meant to suggest processing it a char at a time.
R
On 1/22/2010 9:58 PM, Chris Jones wrote:
On Fri, Jan 22, 2010 at 08:46:35PM EST, Terry Reedy wrote:
Do you mean I should just read the file one character at a time?
Whoops, my misdirection (you can .read(1), but this is s l o w.
I meant to suggest processing it a char at a time.
1. If
On Fri, Jan 22, 2010 at 08:46:35PM EST, Terry Reedy wrote:
> On 1/22/2010 4:47 PM, Chris Jones wrote:
>> I was writing a script that counts occurrences of characters in source code
>> files:
>>
>> #!/usr/bin/python
>> import codecs
>> tcounters = {}
>> f = codecs.open('/home/gavron/git/screen/src/
On 1/22/2010 4:47 PM, Chris Jones wrote:
I was writing a script that counts occurrences of characters in source code
files:
#!/usr/bin/python
import codecs
tcounters = {}
f = codecs.open('/home/gavron/git/screen/src/screen.c', 'r', "utf-8")
for uline in f:
lline = []
for char in uline[:-1
On Fri, Jan 22, 2010 at 05:07:13PM EST, Arnaud Delobelle wrote:
[..]
> import codecs
> from collections import defaultdict
>
> tcounters = defaultdict(int)
> f = codecs.open('/home/gavron/git/screen/src/screen.c', 'r', "utf-8")
>
> for c in f.read():
> tcounters[c] += 1
>
> for c, n in tco
Chris Jones writes:
> I was writing a script that counts occurrences of characters in source
> code files:
>
> #!/usr/bin/python
> import codecs
> tcounters = {}
> f = codecs.open('/home/gavron/git/screen/src/screen.c', 'r', "utf-8")
> for uline in f:
> lline = []
> for char in uline[:-1]:
>