#elements of seq A in seq B

N

Neal Becker

What would be a time efficient way to count the number of occurrences of
elements of sequence A in sequence B? (in this particular case, these
sequences are strings, if that matters).
 
R

Raymond Hettinger

What would be a time efficient way to count the number of occurrences of
elements of sequence A in sequence B?  (in this particular case, these
sequences are strings, if that matters).

Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit
(Intel)] on win32
Type "copyright", "credits" or "license()" for more information.Counter({'a': 5, 'b': 2, 'c': 1})


Raymond
 
R

Raymond Hettinger

What would be a time efficient way to count the number of occurrences of
elements of sequence A in sequence B?  (in this particular case, these
sequences are strings, if that matters).

Python 3.1.1 (r311:74483, Aug 17 2009, 17:02:12) [MSC v.1500 32 bit
(Intel)] on win32
Type "copyright", "credits" or "license()" for more information.Counter({'a': 5, 'b': 2, 'c': 1})

Raymond
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,158
Latest member
Vinay_Kumar Nevatia
Top