Es folgt der Inhalt einer Datei, Meine Frage ist, wie die Anzahl der Vorkommen für das Wort „optimus“ fürCount Vorkommen eines Wortes durch ID in Python
unterschiedliche IDs zählenID67 DATEUID Thank you for choosing Optimus prime. Please wait for an Optimus prime to respond. You are currently number 0 in the queue. You should be connected to an agent in approximately TIMEUID.. You are now chatting with AGENTUID 0
ID67 Optimus MEMORYUID Hi there! Welcome to Optimus prime Web Chat. How can I help you today? 1
ID67 Optimus DATEUID I like to pay prepaid from CURRENCYUID with NUMBERUID expiry on whateve date. my phone no is PHONEUID 2
ID12120 0 0 0 is the number. They are open 0/0 so you can ring them anytime. SMILEUID 1
ID12120 Thanks Optimus, I will give them a call. Thanks for your help! HELPUID 2
ID5552 is the number. They are open 0/0 so you can ring them anytime. SMILEUID 1
ID5552 Thanks Optimus, I will give them a call. Thanks for your help! HELPUID 2
for line in chat.txt:
print line, ####print lines and count optimus word for the particular id..
Ausgabe sein sollte
ID67:4
ID12120
ID5552:1
Bitte lassen Sie uns wissen, was nähern Sie haben gewählt und warum es nicht funktioniert wie erwartet. – Fenikso