Find the ID, but how to select/copy the whole string by ID?

Leon mingliang2000 at gmail.com
Wed Sep 19 09:39:55 EDT 2007


Hi everybody,

I am a beginer for  Python, hope can get help from you guys.
What I want to do is :

Input an ID -> find the ID in the file -> copy the whole string <str
id='xxx'>yyyyy</str>

stringID = str(raw_input('Enter the string ID : '))
file = open('strings.txt')
sourcefile = file.read()
file.close()
sourcefile.find (stringID)

but how can I select and copy the specific string from <str> to </str>
with id I input?

Thanks!!!




More information about the Python-list mailing list