I've done far worse by hitting the wrong key! ;-) I see a post above
gets into the class idea.
Jaggo wrote:
Silly google sent in the middle of my editing. Good
thing it only sent to you then. Please, ignore these 2 messages. Sorry
'bout the mess.
---------- Forwarded message ----------
From: Jaggo <[EMAIL PROTECTED]>
Date: Thu, Sep 11, 2008 at 6:25 PM
Subject: Re: [Tutor] Looking at a String as a Struct?
To: Wayne Watson < [EMAIL PROTECTED]>
I think had I faced this sort of a problem I would've
created a Class for 'em.
Class Person:
Is it possible in Python to
look at a string as a "struct". I don't
think a struct exists in python. Actually, is there something analogous
to a record. In the case of strings, suppose I have string that is
composed of sub-strings like, first_name, last-name, date_of birth,
which consists of month, day, and year, and finally SSN,
street_address, state, city, and zip_code. I'd like to access these
fields directly instead of lastname = record[38:55]. What if fields are
not just strings, but some numeric values?
--
Wayne Watson (Watson Adventures, Prop., Nevada City, CA)
(121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet
"If voting made any difference they wouldn't let us do it."
-- Mark Twain
Web Page: <www.speckledwithstars.net/>
--
Wayne Watson (Watson Adventures, Prop., Nevada City, CA)
(121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
Obz Site: 39° 15' 7" N, 121° 2' 32" W, 2700 feet
"If voting made any difference they wouldn't let us do it."
-- Mark Twain
Web Page: <www.speckledwithstars.net/>
|