[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] stupidity, and a lesson learned



spotter . wrote:
Very interesting ideas. The link will be handy for later use. For now,
I have simply used this format :

name;author;date;version;width;height

and then use split(";") to move them into a list and assign it to
variables then.
Just thought I'd mention, since the split method returns a list, you could do:

name,author,date,version,width,height = astr.split(";")
Does this seem alright, no glaring things I have missed? It does seem
to work from
my small amount of testing that I have put it through.
Yeah, as long as you don't expect any of your values to have semicolons in them.
You could always use something strange like chr(245) as the separator, and it'd be less likely to occur in your values.
But if you're the one defining these map files anyway, just make sure you don't use semicolons.
And make sure you make a note of that if you give people the ability to make custom maps.


Another alternative you could use is defining a Map class and pickling the instances.
-Luke


and Richard - you're right, of course. I didn't notice there weren't quotes.