Help, re SMTP posting / RFC822
Phil Mayes
nospam at bitbucket.com
Fri Sep 17 03:05:21 EDT 1999
Benjamin Schollnick wrote in message ...
>Folks,
>
.[snip intro]
>
>1) def mail_to (self, persons_to_mailto):
> tmp = ''
> tmp = string.splitfields(persons_to_mailto, ',')
> self.to_text = 'To: '
> for count in range(len(tmp)):
># self.to_text = self.to_text + '<'
> self.to_text = self.to_text + tmp[count]
># self.to_text = self.to_text + '\x3E'
> self.to_text = self.to_text + '\n'
>
> See the two commented lines? I can't get them to work in *ANY* form.
> If I have the < or > character
> in 'em, python just seems to goof up and no value gets placed into
>TO_TEXT.
Uh, works for me:
>>> s = 'abc'
>>> s = s + '<'
>>> s
'abc<'
I suspect from the inconsistent indentation of your post that you're
mixing tabs and spaces. I believe this is a Mandatory Python
Learning Experience.
By the way, you can improve performance and legibility with:
tmp = string.splitfields(persons_to_mailto, ',')
self.to_text = 'To: '
for s in tmp:
self.to_text = self.to_text + '<%s>\n' % s
>2) I'm confused about using variables from a OBJECT, inside a routine
>of said object. I was able to write the entire POP3.PY code without
>using SELF.<VAR NAME> and ran it. It seemed that certain
>routines needed SELF, and others would seem to work fine w/o the
>self. Have I used self correctly, or horribly misused it?
Looked OK to me; not sure what you mean here about the pop3 code.
Want to amplify?
--
Phil Mayes pmayes AT olivebr DOT com
More information about the Python-list
mailing list