converting tcl database file to python
Bob Schmertz
schmertz at wam.umd.edu
Sat Jul 15 20:22:36 EDT 2000
Bob van der Poel wrote:
> also thinking that this is dumb. If I were using C I'd use a structure
> like this:
>
> typedef struct{
> char *Title, *Artist, *Composer, *Timing;
> }CDITEM;
> typedef struct{
> char *Name;
> char *Comment;
> char *CDItem[];
> }CDENTRY;
>
> CDENTRY Mydata[maxtitles];
>
> Or something like that. Any suggestions on how that would translate to a
> proper python idiom?
>
Did you consider a CdItem class?
class CDITEM():
def __init__(self, name, comment, etc):
self.name = name
self.comment = comment
self.etc = etc
mydata = []
mydata.append(CDITEM("Thriller", "gift from my mom", "more stuff"))
> 2. Any quick ideas on how to convert the tcl-style data file to
> something python can deal with?
Tcl's probably what I'd go with for this. Haven't dealt with it for a while,
though.
-
Cheers,
Bob Schmertz
More information about the Python-list
mailing list