On Wed, Jun 04, 2003 at 11:18:09AM +0100, Jose' Matos wrote:
> 
>   I point the answer, use split.
> 
> > Could someone write the 5 lines of code? Pleeeease?
> 
> def convert_external(lines):
>     i = 0
>     while 1:
>         i = find_token(lines, "\\begin_inset External", i)
>         if i == -1:
>             break
>         top = "\\begin_inset External"
>         args = string.split(lines[i][len(top)+1:],',')
>         template = "\ttemplate " + args[0]
>         filename = "\tfilename " + args[1]
>         lines[i:i+1] = [top, template, filename]
>         i = i + 1

This will fail if the filename contains ','.
It is probably better to use regular expressions (see my other mail).

Reply via email to