"Wayne Watson" <[EMAIL PROTECTED]> wrote
lIs it possible in Python to look at a string as a "struct".
I assume you mean you have a lot of data all stored in a single
string?
I also assume that either the string has a fixed delimiter - like a
comma
separated file?
Or it has fixed length field
Title: Signature.html
Wayne Watson wrote:
Thanks. I had a hunch that might be a good way to do it. I saw
something like this in other s/w. Now I know what they were up to.
Omer wrote:
Class Person:
def __init__(str):
self.Firstname = str[0:4]
self.Surname =
On Thu, Sep 11, 2008 at 3:58 AM, Wayne Watson
<[EMAIL PROTECTED]>wrote:
> 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
Class Person:
def __init__(str):
self.Firstname = str[0:4]
self.Surname = str[5:7]
(...)
If your string separates the values of each person using tags rather than
fixed lengthes, build it like:
or:
self.Firstname = str[0:str.find("Last name:")]
Title: Signature.html
True enough, but that gets messy. I'd have to keep them perhaps as
global variables or pass then around a lot from function to function as
a collection. I see WW posted above you about dictionaries. Maybe
that's the way to do it. I'll look into it.
Kent Johnson wrote:
On Thu, Sep 11, 2008 at 6:58 AM, Wayne Watson
<[EMAIL PROTECTED]> wrote:
> 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
>
On Thu, Sep 11, 2008 at 5:58 AM, Wayne Watson
<[EMAIL PROTECTED]>wrote:
> 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
Title: Signature.html
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