moonhkt wrote:
> Data file
> V1
> V2
> V3
> V4
> V4
> V3
>
> How to using count number of data ?
>
> Output
> V1 = 1
> V2 = 1
> V3 =2
> V4 = 2
import collections
with open(data_file) as f:
print(collections.Counter(f.readlines()))
it's a start
--
ZeD
--
http://mail.python.org/mai
On 01/23/2013 10:39 AM, moonhkt wrote:
On Jan 23, 11:33 pm, moonhk wrote:
Works.
For some definition of 'works"
prndev = line.split()
# print line
for key in prndev :
if key in 'lpr':
This test will fire if key is the letter "l", or the letter "p"
On Jan 23, 11:33 pm, moonhk wrote:
> Works.
>
> prndev = line.split()
> # print line
> for key in prndev :
> if key in 'lpr':
> val = prndev[5].replace("-P","")
> if val not in printque:
> printque[val] = 1
>
Works.
prndev = line.split()
# print line
for key in prndev :
if key in 'lpr':
val = prndev[5].replace("-P","")
if val not in printque:
printque[val] = 1
else:
printque[val] =
On Jan 23, 3:54 pm, Steven D'Aprano wrote:
> Steven D'Aprano wrote:
>
> I *swear* I only sent it once.
Now Now Steven! Good boys dont swear.
> Arrgggh, it's happened again. Sorry for the multiple posts folks...
> Trying this time with a different news client.
Its a law of the universe called k
Steven D'Aprano wrote:
[snip content]
Arrgggh, it's happened again. Sorry for the multiple posts folks, I *swear*
I only sent it once.
Trying this time with a different news client.
--
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 23 Jan 2013 10:12:25 +, Oscar Benjamin wrote:
> You can't retrieve the value of printque[val] if you haven't yet added
> an entry with the key val to the dict. Try this:
>
> if val not in printque:
> printque[val] = 1
> else:
> printque[val] = printque[val] + 1
Another way of
On Wed, 23 Jan 2013 10:12:25 +, Oscar Benjamin wrote:
> You can't retrieve the value of printque[val] if you haven't yet added
> an entry with the key val to the dict. Try this:
>
> if val not in printque:
> printque[val] = 1
> else:
> printque[val] = printque[val] + 1
Another way of
On Wed, 23 Jan 2013 10:12:25 +, Oscar Benjamin wrote:
> You can't retrieve the value of printque[val] if you haven't yet added
> an entry with the key val to the dict. Try this:
>
> if val not in printque:
> printque[val] = 1
> else:
> printque[val] = printque[val] + 1
Another way of
On Wed, 23 Jan 2013 10:12:25 +, Oscar Benjamin wrote:
> You can't retrieve the value of printque[val] if you haven't yet added
> an entry with the key val to the dict. Try this:
>
> if val not in printque:
> printque[val] = 1
> else:
> printque[val] = printque[val] + 1
Another way of
On 23 January 2013 07:26, moonhkt wrote:
> Hi Al
>
> I have Data file have below
>
> Data file
> V1
> V2
> V3
> V4
> V4
> V3
>
> How to using count number of data ?
>
> Output
> V1 = 1
> V2 = 1
> V3 =2
> V4 = 2
>
>
>
> # Global Veriable
> printque = {}
> in def have below
>
> printque[val] = prin
On Jan 23, 3:34 pm, Chris Rebert wrote:
> On Jan 22, 2013 11:31 PM, "moonhkt" wrote:
>
>
>
>
>
>
>
>
>
>
>
> > Hi Al
>
> > I have Data file have below
>
> > Data file
> > V1
> > V2
> > V3
> > V4
> > V4
> > V3
>
> > How to using count number of data ?
>
> > Output
> > V1 = 1
> > V2 = 1
> > V3 =2
>
On Jan 22, 2013 11:31 PM, "moonhkt" wrote:
>
> Hi Al
>
> I have Data file have below
>
> Data file
> V1
> V2
> V3
> V4
> V4
> V3
>
> How to using count number of data ?
>
> Output
> V1 = 1
> V2 = 1
> V3 =2
> V4 = 2
Construct a frequency table using collections.Counter:
http://docs.python.org/2.7
Hi Al
I have Data file have below
Data file
V1
V2
V3
V4
V4
V3
How to using count number of data ?
Output
V1 = 1
V2 = 1
V3 =2
V4 = 2
# Global Veriable
printque = {}
in def have below
printque[val] = printque[val] + 1
I have below error
File "xprintlogchk.py", line 78, in chklog
print
14 matches
Mail list logo