Re: [Tutor] Fixing garbled email addresses

2007-05-01 Thread Daniel Yoo
Hi Dotan, Just for reference, the weirdness that you're seeing before the email addresses in your text file are "MIME-encoded" strings. http://en.wikipedia.org/wiki/MIME Concretely, the string "=?UTF-8?B?157XqNeZ15Qg15nXoNeY16bXnw==?=" is an encoding of a string in MIME format, and

Re: [Tutor] beautifulSoup and .next iteration

2007-04-13 Thread Daniel Yoo
> anchors = soup.findAll('a', { 'name' : re.compile('^A.*$')}) > for x in anchors: >print x >x = x.next >while getattr(x, 'name') != 'a': > print x > And get into endless loops. I can't help thinking there are simple and > obvious ways to do this, probably many, but as a rank beg

Re: [Tutor] Command line args

2007-04-13 Thread Daniel Yoo
Hi Teresa, Has anyone on this thread already suggested the 'fileinput' module? From what I understand, what 'fileinput' does is exactly what you're asking from: http://mail.python.org/pipermail/tutor/2007-April/053669.html Here's documentation on 'fileinput': http://www.python.org/

Re: [Tutor] please help me

2007-04-13 Thread Daniel Yoo
> If this is homework, please tell your teacher I helped - I need the > extra credit. Please avoid giving homework answers like this. Rather than actually help the person, it can do harm, because it encourages a lazy attitude toward solving problems. ___

Re: [Tutor] Unpickling data after passing over the network

2007-02-11 Thread Daniel Yoo
> a socket. Right now, I am pickling a basic string base 64 encoding and > sending the data over the network. After the recipient client/server > receives the data, it is decoded and then unpickled. The unpickling > fails with an EOFError, and I am not sure why. Hi Adam, Did you "flush" the

Re: [Tutor] Creating an Identifier or Object Name from a String?

2007-02-10 Thread Daniel Yoo
>> I thought when I read the 2002 thread with the subject (Creating an >> Identifier or Object Name from a String?), that I had found a solution >> to my problem. Wait. But what was the solution you ended with? If the conclusion of that thread was to use eval(), then that was the wrong lesso

Re: [Tutor] Identity operator (basic types)

2007-02-09 Thread Daniel Yoo
>> Why does the identity operator return "True" in the below cases, >> that is when assigning the same value to basic variable types >> (float, integer, string, bool..)? Are these rcopied by reference >> (shallow)? If so why? >> > i = 10 > j = 10 > i is j >> True The above you have

Re: [Tutor] Range of float value

2007-02-08 Thread Daniel Yoo
On Thu, 8 Feb 2007, Johan Geldenhuys wrote: > OK, this what I wanted: > > I have a value: a = 48.41 > > My lowValue is: lowValue = 48.35 > My highValue is : highvalue = 48.45 Range does not work on floats: it's meant to work on integers. > I though that it could be possible to have a range b

Re: [Tutor] How does this work?

2007-02-06 Thread Daniel Yoo
On Tue, 6 Feb 2007, Daniel Yoo wrote: >> this is the callee which is saved in tester.py >> ## >> import sys >> >> def main(arg): >> if arg != []: >> print"\nArgument is %s" % arg

Re: [Tutor] How does this work?

2007-02-06 Thread Daniel Yoo
On Tue, 6 Feb 2007, Tony Cappellini wrote: > this is the caller > ## > callee=open("tester.py").read() > exec(callee) > eval("main(['', 'argument'])") > > ## > this is the callee which is saved in tester.py > ##

Re: [Tutor] CRC calculation with python

2007-02-06 Thread Daniel Yoo
On Tue, 6 Feb 2007, Johan Geldenhuys wrote: > I'm not a C++ expert at all and I would like to find out if somebody can > explain to me how the statement below can be done in Python? > > """ > _uint16 ComCRC16(_uint8 val, _uint16 crc) > { >_uint8 i; >_uint16 cval; > >for (i=0

Re: [Tutor] curious struct problem

2007-02-05 Thread Daniel Yoo
On Mon, 5 Feb 2007, Marcus Goldfish wrote: > I think I found the problem: the last chunk read is incomplete, so there > is size(chunk) is not sufficient to unpack according to the format > string. Good! I'm glad you found the problem. ___ Tutor mai