Re: simple text parser?

Discussion in 'Python' started by Alex Martelli, Aug 17, 2003.

  1. Brandon J. Van Every wrote:
    ...
    > I'm making a 2D game with a simple "adjacent freeform territories" map. I
    > need to make save files for this. I figure I could store the data in
    > either
    > binary or text. The amount of data to be stored should be small enough
    > that
    > efficiency and size do not matter. What does matter, is I don't want to
    > spend any time at all on this. I want something off-the-shelf.
    >
    > Can anyone recommend simple text parsers implemented in Python?
    >
    > Alternately, doesn't Python have some kind of automagical serialization
    > pack/unpack functionality? How does that work? I remember reading


    As several others appear to have indicated already, cPickle is generally
    the best module for serializing your data (e.g. to disk) under the
    general conditions you're specifying. The other suggestions (CSV, XML,
    and so forth) were based on misunderstanding your specs as meaning you
    needed _interoperability_ between Python and C# versions, which you
    have later clarified is not the case.


    > something about that in the Python docs awhile ago. Before you scream
    > RTFM, bear in mind that my current plan is to write versions of this game
    > in C# /
    > .NET and Python / WhateverWidgets simultaneously. I'm ignorant of both
    > platforms, this is an excuse to do a comparo. And, the whole point of
    > moving to higher level language development is to minimize pain. Asking
    > questions here rather than reinventing the wheel is part of that agenda.
    > I want to handle this problem off-the-shelf.


    Developing a program under each of two platforms you previously didn't
    know is no doubt a good way to compare several characteristics of those
    platforms. Out of curiosity -- are you relying on Usenet help, rather
    than a manual, for the C# version, too?


    Alex
     
    Alex Martelli, Aug 17, 2003
    #1
    1. Advertising

  2. Alex Martelli wrote:
    >
    > Developing a program under each of two platforms you previously didn't
    > know is no doubt a good way to compare several characteristics of
    > those platforms. Out of curiosity -- are you relying on Usenet help,
    > rather than a manual, for the C# version, too?


    Not exactly. I have 2 books on C#, but they don't talk about parsing except
    via XML. At some point I will ask about C# parsers, but probably not until
    I get stuck on the Python way of doing things.

    Cheers,
    Brandon
     
    Brandon J. Van Every, Aug 17, 2003
    #2
    1. Advertising

  3. Brandon J. Van Every wrote:

    > Alex Martelli wrote:
    >>
    >> Developing a program under each of two platforms you previously didn't
    >> know is no doubt a good way to compare several characteristics of
    >> those platforms. Out of curiosity -- are you relying on Usenet help,
    >> rather than a manual, for the C# version, too?

    >
    > Not exactly. I have 2 books on C#, but they don't talk about parsing
    > except
    > via XML. At some point I will ask about C# parsers, but probably not
    > until I get stuck on the Python way of doing things.


    I still don't understand why you need parsing for your expressed
    purpose (saving data to disk and restoring them, with no effort) --
    surely C# has its own object-serialization modules already implemented
    for your use, just like Python has cPickle and Java its own serialization
    library modules.


    Alex
     
    Alex Martelli, Aug 18, 2003
    #3
  4. Alex Martelli wrote:
    >
    > I still don't understand why you need parsing for your expressed
    > purpose (saving data to disk and restoring them, with no effort) --
    > surely C# has its own object-serialization modules already implemented
    > for your use, just like Python has cPickle and Java its own
    > serialization library modules.


    At this point I agree with you. I don't know about C#'s features, I'll be
    finding out.


    --
    Cheers, www.3DProgrammer.com
    Brandon Van Every Seattle, WA

    20% of the world is real.
    80% is gobbledygook we make up inside our own heads.
     
    Brandon J. Van Every, Aug 18, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Phil Hanna

    Re: simple text config file parser?

    Phil Hanna, Jul 1, 2003, in forum: Java
    Replies:
    0
    Views:
    3,207
    Phil Hanna
    Jul 1, 2003
  2. Bernd Oninger
    Replies:
    0
    Views:
    772
    Bernd Oninger
    Jun 9, 2004
  3. Irmen de Jong

    Re: simple text parser?

    Irmen de Jong, Aug 17, 2003, in forum: Python
    Replies:
    1
    Views:
    471
    Brandon J. Van Every
    Aug 17, 2003
  4. Michael Peuser

    Re: simple text parser?

    Michael Peuser, Aug 17, 2003, in forum: Python
    Replies:
    0
    Views:
    392
    Michael Peuser
    Aug 17, 2003
  5. mike b.
    Replies:
    3
    Views:
    178
    James Edward Gray II
    Jul 30, 2007
Loading...

Share This Page