RE: [Tutor] What am I doing wrong...

2004-12-23 Thread Isr Gish
John Purser wrote: [snip] >I'm not sure if this is your code or my mail agent (outlook) but as you can >see below there's a space between the function name (main) and the >parenthesis. I don't believe that's supposed to be there. I don't think there is any problem with adding space befo

Re: [Tutor] Re: tempfile (fwd)

2004-12-23 Thread Marilyn Davis
And again. -- Forwarded message -- Date: Thu, 23 Dec 2004 14:55:15 -0800 (PST) From: Marilyn Davis <[EMAIL PROTECTED]> To: Lee Harr <[EMAIL PROTECTED]> Subject: Re: [Tutor] Re: tempfile os.lseek! How did I not find that. Thank you. I'm set. Marilyn On Fri, 24 Dec 2004, Lee Ha

Re: [Tutor] tempfile (fwd)

2004-12-23 Thread Marilyn Davis
Ooops. I forgot to send to the list. -- Forwarded message -- Date: Thu, 23 Dec 2004 14:53:18 -0800 (PST) From: Marilyn Davis <[EMAIL PROTECTED]> To: QoD SEC <[EMAIL PROTECTED]> Subject: Re: [Tutor] tempfile On Thu, 23 Dec 2004, QoD SEC wrote: > you could use the seek method of

Re: [Tutor] Re: tempfile

2004-12-23 Thread Liam Clarke
fileObj=... fileObj.seek()? Is what I use, although that's for specific byte positions I believe. On Fri, 24 Dec 2004 03:09:31 +0430, Lee Harr <[EMAIL PROTECTED]> wrote: > >I'm using tempfile. The doc says it is opened 'w+b' so that it can be > >read and written without closing and reopening. >

[Tutor] Re: tempfile

2004-12-23 Thread Lee Harr
I'm using tempfile. The doc says it is opened 'w+b' so that it can be read and written without closing and reopening. But, for the life of me, I can't find any way to rewind it so I can read what I wrote. import tempfile import os fd, name = tempfile.mkstemp() os.write(fd, 'foo') 3 os.lseek(fd, 0

Re: [Tutor] Is there an easy way to conduct binary numbers?

2004-12-23 Thread Orri Ganel
On Thu, 23 Dec 2004 20:42:50 +0800, Juan Shen <[EMAIL PROTECTED]> wrote: > I have found there are easy functions and options to do basic octal and > hexadecimal number operation. > > oct(...) > oct(number) -> string > > Return the octal representation of an integer or long integer. > > hex(...)

[Tutor] tempfile

2004-12-23 Thread Marilyn Davis
Hello Python Tutors, I'm using tempfile. The doc says it is opened 'w+b' so that it can be read and written without closing and reopening. But, for the life of me, I can't find any way to rewind it so I can read what I wrote. tempfile.mkstemp gives me the file descriptor. Is there a way to mak

Re: [Tutor] Is there an easy way to conduct binary numbers?

2004-12-23 Thread Kent Johnson
Googling in comp.lang.python for "convert binary" gives several solutions including the ones in this thread: http://tinyurl.com/6dwom Juan Shen wrote: > I have found there are easy functions and options to do basic octal and > hexadecimal number operation. > > oct(...) > oct(number) -> string >

Re: [Tutor] What am I doing wrong...

2004-12-23 Thread Marilyn Davis
Hi Ken, Welcome to python! Adding one line should do it for you: On Thu, 23 Dec 2004, Ken Stevens wrote: > I am a elative new comer to python. I wrote the following test > snippet. > > #!/usr/bin/env python > > def main (): > play_test() > > def play_test (): > print "Hi! -- in play

RE: [Tutor] What am I doing wrong...

2004-12-23 Thread John Purser
The basic problem is you never told Python to DO anything except define what it would do if anyone asked it to. If you add the line "main()" to the bottom you'll get your message printed. I'm not sure if this is your code or my mail agent (outlook) but as you can see below there's a space between

Re: [Tutor] What am I doing wrong...

2004-12-23 Thread Roger Merchberger
Rumor has it that Ken Stevens may have mentioned these words: I am a elative new comer to python. I wrote the following test snippet. #!/usr/bin/env python def main (): play_test() def play_test (): print "Hi! -- in play test" When I do "python test.py" absolutely nothing happens. Correct.

[Tutor] What am I doing wrong...

2004-12-23 Thread Ken Stevens
I am a elative new comer to python. I wrote the following test snippet. #!/usr/bin/env python def main (): play_test() def play_test (): print "Hi! -- in play test" When I do "python test.py" absolutely nothing happens. I expect it to do the print statement. Thanks in advance for yo

Re: [Tutor] Is there an easy way to conduct binary numbers?

2004-12-23 Thread Blake Winton
Juan Shen wrote: > Binary integer is extremely useful in my > electronic-related job. So...I need help. Is there any function to > transform between binary and decimal integers in python's library? If > not, what's the solution to binary? I can't speak for everyone, but most of the people I've met

[Tutor] Is there an easy way to conduct binary numbers?

2004-12-23 Thread Juan Shen
I have found there are easy functions and options to do basic octal and hexadecimal number operation. oct(...) oct(number) -> string Return the octal representation of an integer or long integer. hex(...) hex(number) -> string Return the hexadecimal representation of an integer or long integer.

Re: [Tutor] silly question

2004-12-23 Thread Alan Gauld
> how do I change global variables within a function: > by declaring them as global. See my tutorial topic: "Whats in a Name?" for a discussion of this. > ## > VAR = "TEST" > > def m(): > VAR="no test" creates a new variable insidethe function. def m(): g

Re: [Tutor] silly question

2004-12-23 Thread Alan Gauld
> sorry everyone, I figured it out on my own ;) So having made it a tutor topic, please close the discussion by telling us what was wrong. That way the rest of us don't spend the rest of the day worrying about it, saying "I wonder what Jason did wrong?" :-) Sorry if I appear to nag but its how th