a simple string question

Zentrader zentraders at gmail.com
Sat Jul 28 13:01:24 EDT 2007


>  >>> Short_Text="n=90; if n==90:print 'ok'"
>  >>> compound_lines = Short_Text.split(";")
>  >>> for line in compound_lines:
> ...   line = line.replace(":", ":\n    ")
> ...   print line
> ...
> n=90
>   if n==90:
>      print 'ok'

A variation of this will work if the input file isn't too
complicated.  I found this link with a Google of "c to python".  This
will give you an idea of how difficult it can be if you take into
account every possibility when converting.  You might check the web
first, since someone has probably already done what you want.  Good
luck.
http://www.catb.org/~esr/ctopy/




More information about the Python-list mailing list