Re: [f2py] Newbie question
Pearu Peterson <[email protected]> Tue, 21 Jun 2011 21:33:04 +0300
| Newsgroups | gmane.comp.python.f2py.user |
|---|---|
| Message-ID | <[email protected]> |
On Tue, Jun 21, 2011 at 8:17 PM, Jean-Christophe Roche <roche-/[email protected]>wrote: > Hi, > > I would like to extract a piece of code (a type, a subroutine, ...) from > a Fortran file. I need to extract the code exactly as it is in the > source file (with comments, blank lines, spaces, tabs, ...). > > I try to use the api.walk function but comments are not take into > account. Then I try to work with the api.parse function with the option > ignore_comments=False but I don't find how to get exactly the code as it > is in the source file (stmt.item.line and stmt.item.strline are not > exactly the original code). > > You could use either of methods for establishing the starting and finishing line numbers of the interested piece of code. And then read only those lines via simple file operations. HTH, Pearu _______________________________________________ f2py-users mailing list f2py-users-Y4l6ocDipWCuvFJfX82//[email protected] http://cens.ioc.ee/mailman/listinfo/f2py-users