I have a very long string which contains lots of MAC address, see below: str_long = '3A9059D46237,2047DAACE894,2047DAACE894,2047DAACE894,2047DAACE894,…'
Each sub-string is a MAC address, e.g. 3A9059D46237. They are separated by a comma.
How can I count the occurrences of each sub-string?
Should I use a loop to do this? Your suggestion and ideas are highly appreciated. Thanks in advance
Best Answer