Hello ! I am trying to make a little program, which would go through the string content, find some keywords inside of it and return their position in the text. Unfortunately my program does not work for the duplicated words like "AFIX" or "CONF" (see example bellow). Is there simple way to make this work for all words in a string ?
Thanks for help!
text='''ZERR
LATT 1
SYMM -X, 0.5+Y, 0.5-Z
SFAC C H N O P Ni
UNIT 208 232 8 32 16 8
L.S. 3
AFIX
AFIX
ACTA
BOND $H
FMAP 2
PLAN 20
SIZE 0.12 0.15 0.12
WPDB -1
CONF
CONF
TEMP -123.000
WGHT 0.044900
FVAR 0.05358
AFIX
AFIX
AFIX
AFIX'''
listofwords=["CELL", "ZERR", "LATT", "END", "REM", "SYMM", "SFAC", "UNIT", "L.S.", "ACTA", "BOND $H", "FMAP", "PLAN", "SIZE", "WPDB", "CONF", "TEMP", "WGHT", "FVAR", "MOLE", "PART", "AFIX","ANIS", "WGHT"]
for i in listofwords:
item = text.find(i)
print item