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

Re: [pygame] stupidity, and a lesson learned



On 12/18/06, Luke Paireepinart <rabidpoobear@xxxxxxxxx> wrote:
> 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.


Ah, thanks Luke, it would be much easier if I used a nonstandard
character. Thanks for the name, author, date = data.split(";"). I keep
forgetting how easy it is to do stuff in python.

-spot