Answer the question
In order to leave comments, you need to log in
How can I collect domain statistics in a file?
There is a file that contains the lines
[email protected]:password
[email protected]:password
[email protected]:password
domen - сколько всего в файле
Answer the question
In order to leave comments, you need to log in
Well, if you give us a list instead of a file, then we will assume that you can create the corresponding list from the file. Let this be the lines list in the example below.
And then - everything is simple:
import re
lines=["[email protected]:password","[email protected]:password","[email protected]:password",
"[email protected]:password","[email protected]:password", "[email protected]:password",
"[email protected]:password","[email protected]:password"]
st_list=[]
for ln in lines:
st=re.findall(r"\@(.*?)\:", ln)
st_list.append(st[0])
st_count = {i: st_list.count(i) for i in st_list}
print (st_count)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question