This shows you the differences between two versions of the page.
— |
parse3.py [2012/03/09 10:43] (current) |
||
---|---|---|---|
Line 1: | Line 1: | ||
+ | |||
+ | anyfilename = ' | ||
+ | f = open(anyfilename,' | ||
+ | output = [] | ||
+ | newoutput=[] | ||
+ | htmloutput=[] | ||
+ | for line in f: | ||
+ | if '' | ||
+ | output.append(line) | ||
+ | f.close() | ||
+ | |||
+ | |||
+ | ''' | ||
+ | count = 0 | ||
+ | number_of_lines = 0 | ||
+ | linenumber = 0 | ||
+ | |||
+ | for i in output: | ||
+ | |||
+ | count = count+1 | ||
+ | |||
+ | |||
+ | ''' | ||
+ | |||
+ | number_of_lines = count | ||
+ | |||
+ | for i in range(0, number_of_lines): | ||
+ | | ||
+ | ''' | ||
+ | ''' | ||
+ | | ||
+ | else: | ||
+ | print ' | ||
+ | print " " | ||
+ | print " " | ||
+ | ''' | ||
+ | print " | ||
+ | for i in range(0, number_of_lines): | ||
+ | search = '</ | ||
+ | output[i].find(search) | ||
+ | index = output[i].find(search) | ||
+ | | ||
+ | ''' | ||
+ | ''' | ||
+ | cut_text_from_string=output[i][13: | ||
+ | print ' \n' | ||
+ | print cut_text_from_string | ||
+ | if '' | ||
+ | newoutput.append(cut_text_from_string) | ||
+ | print 'We have now removed all heading text and trailing text after the ":" | ||
+ | print " | ||
+ | |||
+ | ''' | ||
+ | actual_imagefilename - Is the primary variable to find as most of the latter variables will depend upon it, this we | ||
+ | read from within the tags < | ||
+ | on | ||
+ | ''' | ||
+ | for i in range(0, number_of_lines): | ||
+ | search = '< | ||
+ | newoutput[i].find(search) | ||
+ | index = newoutput[i].find(search) | ||
+ | print search, "found at index", | ||
+ | indexvalue1=int(index) | ||
+ | print indexvalue1 | ||
+ | actual_soundfilename = newoutput[i][indexvalue1+11: | ||
+ | print actual_soundfilename | ||
+ | |||
+ | ''' | ||
+ | |||
+ | soundplayback = '< | ||
+ | print "This is the soundplayback / embed sentencegeneration" | ||
+ | |||
+ | ''' | ||
+ | the_HTML_playbackname_for_an_image = actual_soundfilename + ' | ||
+ | print the_HTML_playbackname_for_an_image | ||
+ | |||
+ | search2 = '</ | ||
+ | newoutput[i].find(search2) | ||
+ | index = newoutput[i].find(search2) | ||
+ | print search2, "found at index", | ||
+ | indexvalue2=int(index) | ||
+ | print indexvalue2 | ||
+ | an_alternate_title_for_the_image_for_HTML_purposes = newoutput[i][: | ||
+ | print an_alternate_title_for_the_image_for_HTML_purposes | ||
+ | the_title_of_the_image = an_alternate_title_for_the_image_for_HTML_purposes | ||
+ | print the_title_of_the_image + 'Is the text displayed on a mouseover' | ||
+ | | ||
+ | search3 = '</ | ||
+ | newoutput[i].find(search3) | ||
+ | index = newoutput[i].find(search3) | ||
+ | print search3, "found at index", | ||
+ | indexvalue3=int(index) | ||
+ | print indexvalue3 | ||
+ | actual_imagefilename = newoutput[i][indexvalue3-8: | ||
+ | print actual_imagefilename | ||
+ | |||
+ | an_alternate_title_for_the_image_for_HTML_purposes = 'This is the image for ' + an_alternate_title_for_the_image_for_HTML_purposes + ' ' + actual_imagefilename | ||
+ | |||
+ | print an_alternate_title_for_the_image_for_HTML_purposes | ||
+ | |||
+ | ''' | ||
+ | | ||
+ | generatedHTMLstring = soundplayback + ' <PRE> <UL> <td style=" | ||
+ | |||
+ | print generatedHTMLstring | ||
+ | |||
+ | htmloutput.append(generatedHTMLstring+' | ||
+ | |||
+ | anyfilename2 = ' | ||
+ | fob2 = open(anyfilename2,' | ||
+ | fob2.writelines(htmloutput) | ||
+ | fob2.close() | ||
+ | |||
+ | |||
+ | |||
+ | print "Hallo der" | ||
+ | ''' | ||
+ | ''' | ||
+ | ''' | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | ''' | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | search = '< | ||
+ | string.find(search) | ||
+ | index = string.find(search) | ||
+ | print search, "found at index", | ||
+ | search2 = '</ | ||
+ | string.find(search2) | ||
+ | index = string.find(search2) | ||
+ | print search2, "found at index", | ||
+ | cut_text_from_string = string[7: | ||
+ | print cut_text_from_string | ||
+ | |||
+ | ''' | ||