simple text parser?
Irmen de Jong
irmen at -NOSPAM-REMOVETHIS-xs4all.nl
Sun Aug 17 05:36:49 EDT 2003
More information about the Python-list mailing list
Sun Aug 17 05:36:49 EDT 2003
- Previous message (by thread): simple text parser?
- Next message (by thread): simple text parser?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Brandon J. Van Every wrote: > Can anyone recommend simple text parsers implemented in Python? You can use Python's own pickle mechanism to serialize almost any Python object(s). But you won't be able to read it back in if you also want to build it in another language such as C# that you mentioned. Perhaps you're better off using a simple .ini file structure, that should be *very* easy to parse in C# (I suspect it has .ini file parsing support built-in) and Python has the ConfigParser module. Or you could use a CSV (Comma Separated Values) file format, that is easily generated and parsed from Python's csv module and should also be easy to do from other languages. Alternatively you can go for something like this: ---------------- item1=value1 item2=value2 item3=value3 ... ---------------- This is perhaps the easiest to create and parse, because in Python, you just execfile() or eval() the file back in. Warning: if somebody puts extra Python code in it, that will be executed. HTH, --Irmen de Jong
- Previous message (by thread): simple text parser?
- Next message (by thread): simple text parser?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list