For file:
aaEbb
aEEbb
EaEbb
EaEbE
the expected output is
2 1 0 1
In the first column there is 2 E, so the output is 2 E, second column is 1
E.
#!/bin/python
import os.path
tokens=['B','E']
for fileName in os.listdir("."):
result=[]
if os.path.isfile(fileName) and os.path.splitext(fileName)[1]==".xpm":
filedata = open(fileName)
text=filedata.readlines()
for line in text[0:]:
result.append({t:line.strip().count(t) for t in tokens})
for index,r in enumerate(result):
outfiledata=open("fileName.txt","w")
Thanks,
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor