Home | Trees | Indices | Help |
|
---|
|
Behaves like a file object, except that when iterating over file lines only non-blank, non-comment lines are returned and any EOL characters are removed together with trailing white-space. Use this class just like the file class when reading files:
from wsatools.Utilities import ParsedFile for line in ParsedFile("myfile.txt"): print(line)
|
|||
str |
|
||
str |
|
||
list(str) |
|
||
Inherited from Inherited from |
|
|||
commentMarker =
Comment marker string. |
|||
stripEOLComments = False Strip comments from the end of lines too? |
|
|||
Inherited from Inherited from |
|
Note: Unfortunately, I have reimplemented the base-class design for next() because the base-class does not call this readline() method. Could have chosen to call the base-class next() method and then parsed in the exact same way as readline() is parsed (save for the EOF return condition that is shouldn't be in the next() implementation). However, this way should be more efficient and maintainable. |
Retain newline. A non-negative size argument limits the maximum number of bytes to return (an incomplete line may be returned then). Return an empty string at EOF.
|
Call readline() repeatedly and return a list of the lines so read. The optional size argument, if given, is an approximate bound on the total number of bytes in the lines returned.
Note: Unfortunately, I have reimplemented the base-class design for readlines() because the base-class does not call this readline() method. Could have chosen to call the base-class readlines() method and then parsed in the same way as readline(), but this way should be more efficient and maintainable. |
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Mon Sep 8 15:46:57 2014 | http://epydoc.sourceforge.net |