Re: [Tutor] OO re-factoring (was Pythonese/Efficiency/Generalesecritique)

2005-06-08 Thread Alan G
 You've certainly given me a mouthful to chew on :~)  I was thinking
 more in terms of OOP is about code reuse

Thats not a good approach to OOP. Code reuse is often as easy
to achieve using modules and functions.

As Javier said OOP is aboiut things - objects. You need to
build your whole design around objects communicating with
each other, each with some responsibility within the program.
The methods implement those responsibilities.

Inheritance is a way of abstracting up from specific things to
higher level things - the fact that it saves some coding sometimes
is a bonus side-effect. In a perfect OO design you should be
able to describe (and build) the system using entirely abstract
classes, then to make it effective simple implement the sub-classes
and plug them in. Its rarely as clean as that but its the goal towards
which OO designers strive.

 I'm not actually looking for the best approach here - rather just
 trying to map a concept I'm familiar with to a new (to me) concept.

Thats an OK approach, but the way to map to OOP is to:

1) say what are the objects?

2) can I group the objects into super/sub class chunks

3) what are the responsibilities of each class within my problem

4) build one class, the lowest level one, with no dependencies on the
others

5) test it (at the  prompt?)

6) build another class with no dependencies on as yet unbuilt classes

7) test it at the  prompt

8) test it in in conjunction with the other classes it uses.

9) repeat 6-9 until all classes are built and tested (or enough to
   implement some part of your application - a use case).

10) build the driver program/fuinctoion/object that will pull it
all together into an application.

And ask questions here as you go :-)

Alan G
Author of the Learn to Program web tutor
http://www.freenetpages.co.uk/hp/alan.gauld

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] remove from python

2005-06-08 Thread Liam Clarke
Personally, I find the Digest a bit harder to use, so I just use my
gmail account for the list, and use filters to automatically tag the
Python list, and gmail's so ludicrously big, you don't really notice
that you have 2208 messages stored. Then they're easy to search through
as well. 

Liam ClarkeOn 6/8/05, Danny Yoo [EMAIL PROTECTED] wrote:
On Tue, 7 Jun 2005, The Johnsons wrote: how can i get my email address removed, I'm receiving way too many emailsHi Raywood1,You have a few options.You may want to see if just turning the Tutor
mailing list setting to Digest Mode might help.You can do thisthrough:http://mail.python.org/mailman/options/[EMAIL PROTECTED]
Digest mode will bundle up messages from Tutor so that you don't get sodeluged.If you want to unsubscribe, there should be instructions on howto do so from that page too.Finally, if you have more questions on administrative stuff, or if you run
into difficulty while unsubscribing, then send an email to[EMAIL PROTECTED], and the administrators will help you get off thelist.___
Tutor maillist-Tutor@python.orghttp://mail.python.org/mailman/listinfo/tutor
-- 'There is only one basic human right, and that is to do as you damn well please.And with it comes the only basic human duty, to take the consequences.'
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] keylogger

2005-06-08 Thread Liam Clarke
Out of curiosity, why the interest in logging keys?

I'm also pretty sure that a Python programme couldn't run as quietly as most keyloggers tend to...On 6/8/05, Vladimir Rasputin 
[EMAIL PROTECTED] wrote:Can i make a keylogger using python?has anyone ever made one/tryed to make one?
does any one know how to make one?_Express yourself instantly with MSN Messenger! Download today it's FREE!
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/___Tutor maillist-Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor-- 'There is only one basic human right, and that is to do as you damn well please.And with it comes the only basic human duty, to take the consequences.'
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Tutor Digest, Vol 16, Issue 22

2005-06-08 Thread tangyuejun

I am looking for a web scraping sample.who
can help me?
Best  Regards

Adam Tang
Myetone info.tech. Co.,Ltd.
Tel: (021)53852321-801
Fax:(021)53852320
Mail: [EMAIL PROTECTED]
Msn:[EMAIL PROTECTED]
Skype:tangyuejun
Address: 403 Room,18 Xichang Road(M) 
Ganglu Plaza Shanghai,China
Post Code: 21
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Web scraping

2005-06-08 Thread Kent Johnson
[EMAIL PROTECTED] wrote:
 
 I am looking for a web scraping sample.who can help me?

Take a look at Beautiful Soup
http://www.crummy.com/software/BeautifulSoup/

Kent

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] OO re-factoring (was Pythonese/Efficiency/Generalese critique)

2005-06-08 Thread Kent Johnson
Lee Cullens wrote:
 I was thinking of extending the learning exercise by re-factoring it  
 as an OO approach, since it would contain a minimum altered method.   
 Being new to OOP also though, I'm confusing myself with how that  
 would be best accomplished.  My thinking is that class/subclass  
 method instances would replace the recursive functions approach, but  
 have as yet not formed the coding in my mind.

Using an OOP approach won't change the algorithm from recursive to 
non-recursive.

To me, OOP is about code organization and abstraction. It is a way to collect 
code and data into chunks that can be used at a higher level of abstraction 
than just the raw data. OOP is not necessary for reuse - functional modules can 
be very useful and reusable.

There is a spectrum of re-use. Many of my programs have classes that are only 
instantiated once. They are not reused but they provide a useful way to 
organize the code and provide a useful building block for the rest of the 
program. I also have many classes that are reused within the program containing 
them, this is an important kind of reuse. And some classes I write are more 
broadly useful and are re-used in more than one program.

I have written an essay about when to use classes that approaches the question 
from a very simple, practical point of view.
http://www.pycs.net/users/323/stories/15.html

Javier's File and Dir classes are strongly reminiscent of the path class in J 
Orendorff's path module; you might want to take a look at it. Highly 
recommended for file and directory manipulations.
http://www.jorendorff.com/articles/python/path/

Alan G wrote:
 4) build one class, the lowest level one, with no dependencies on the
 others

Yes!! Try to think of your classes as reusable modules even if you don't 
anticipate reusing them! Don't allow dependency cycles.

 5) test it (at the  prompt?)

Testing is good. Do yourself a favor and learn how to use unittest (or doctest 
or py.test). If you write your tests as unit tests instead of doing them by 
hand in the interpreter, you can re-run the tests as needed. This is invaluable 
when you make a change to your code and want to know if you have broken 
anything - you don't have to test manually, you just run the unit test.

Kent

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] OO re-factoring (was Pythonese/Efficiency/Generalese critique)

2005-06-08 Thread Liam Clarke
Path looks good. Cheers Kent. On 6/8/05, Kent Johnson [EMAIL PROTECTED] wrote:
Lee Cullens wrote: I was thinking of extending the learning exercise by re-factoring it as an OO approach, since it would contain a minimum altered method. Being new to OOP also though, I'm confusing myself with how that
 would be best accomplished.My thinking is that class/subclass method instances would replace the recursive functions approach, but have as yet not formed the coding in my mind.Using an OOP approach won't change the algorithm from recursive to non-recursive.
To
me, OOP is about code organization and abstraction. It is a way to
collect code and data into chunks that can be used at a higher level of
abstraction than just the raw data. OOP is not necessary for reuse -
functional modules can be very useful and reusable.There is a
spectrum of re-use. Many of my programs have classes that are only
instantiated once. They are not reused but they provide a useful way to
organize the code and provide a useful building block for the rest of
the program. I also have many classes that are reused within the
program containing them, this is an important kind of reuse. And some
classes I write are more broadly useful and are re-used in more than
one program.I have written an essay about when to use classes that approaches the question from a very simple, practical point of view.http://www.pycs.net/users/323/stories/15.html
Javier's
File and Dir classes are strongly reminiscent of the path class in J
Orendorff's path module; you might want to take a look at it. Highly
recommended for file and directory manipulations.http://www.jorendorff.com/articles/python/path/Alan G wrote: 4) build one class, the lowest level one, with no dependencies on the
 othersYes!! Try to think of your classes as reusable modules even if you don't anticipate reusing them! Don't allow dependency cycles. 5) test it (at the  prompt?)Testing
is good. Do yourself a favor and learn how to use unittest (or doctest
or py.test). If you write your tests as unit tests instead of doing
them by hand in the interpreter, you can re-run the tests as needed.
This is invaluable when you make a change to your code and want to know
if you have broken anything - you don't have to test manually, you just
run the unit test.Kent___Tutor maillist-Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor-- 'There is only one basic human right, and that is to do as you damn well please.And with it comes the only basic human duty, to take the consequences.'
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Web scraping

2005-06-08 Thread Liam Clarke
An alternative win32 approach is - 
Use something like IEC http://www.mayukhbose.com/python/IEC/index.php
or PAMIE http://pamie.sourceforge.net/, or you can use the python win32
extensions http://starship.python.net/crew/skippy/win32/Downloads.html
and use IE  navigate through the DOM... but PAMIE is easier.

Good luck.On 6/8/05, Kent Johnson [EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] wrote: I am looking for a web scraping sample.who can help me?Take a look at Beautiful Soup
http://www.crummy.com/software/BeautifulSoup/Kent___Tutor maillist-Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor-- 'There is only one basic human right, and that is to do as you damn well please.And with it comes the only basic human duty, to take the consequences.'
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] OO re-factoring (was Pythonese/Efficiency/Generalesecritique)

2005-06-08 Thread Lee Cullens
Javier, Allen, Kent, Liam

Hmm, I think I understand what you all are saying.  Basically, my  
familiar take on code reuse (the function model) as used in the  
utility is essentially not rewriting any more of a block than what is  
different, as opposed to do all blocks with convoluted switching.   
Whereas what it seems to me you are saying is levels of functional  
abstraction more akin to the Unix model.

My only prior experience with OOP was with Lingo several years ago in  
a variable record file use, which was simple to grasp.

Obviously my take is flawed, so I will study the material noted,  
reread my Learning Python Part VI, and take another stab at it.

No doubt this is rank amateurish to you all - somewhat like I felt  
back in the 80's when a senior analyst asked me how to use more  
than one output file in a COBOL program ;')  Anyway, starting with  
assembler in the 60s, and doing my last substantial technical work in  
the 80s with C and Pascal, I have a bit of catching up to do :~)

Thank you all for pointing me in the right direction,
Lee C

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] OO re-factoring (was Pythonese/Efficiency/Generalesecritique)

2005-06-08 Thread Liam Clarke
Hey Lee, 

I can empathise with your learning of OO. Once you get past the buzz,
it's just a way of designing programmes that's good for certain
situations. Very useful for things like writing text validators for
GUIs as an abstract class and subclassing all windows from that to
inherit the validator functions for every text field, but I'd rarely
create a class for some linear text processing. 

Regards,

Liam ClarkeOn 6/9/05, Lee Cullens [EMAIL PROTECTED] wrote:
Javier, Allen, Kent, LiamHmm, I think I understand what you all are saying.Basically, myfamiliar take on code reuse (the function model) as used in theutility is essentially not rewriting any more of a block than what is
different, as opposed to do all blocks with convoluted switching.Whereas what it seems to me you are saying is levels of functionalabstraction more akin to the Unix model.My only prior experience with OOP was with Lingo several years ago in
a variable record file use, which was simple to grasp.Obviously my take is flawed, so I will study the material noted,reread my Learning Python Part VI, and take another stab at it.No doubt this is rank amateurish to you all - somewhat like I felt
back in the 80's when a senior analyst asked me how to use morethan one output file in a COBOL program ;')Anyway, starting withassembler in the 60s, and doing my last substantial technical work in
the 80s with C and Pascal, I have a bit of catching up to do :~)Thank you all for pointing me in the right direction,Lee C-- 'There is only one basic human right, and that is to do as you damn well please.
And with it comes the only basic human duty, to take the consequences.'
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] FW: Tutor Digest, Vol 16, Issue 21, #3 Text problem

2005-06-08 Thread EUGENE ASTLEY
I tried your suggestion but it does not work for me. I get a syntax
error at use of the first question mark when trying it in Idle.
When I try it from the desktop, it just flashes a black screen and
returns me to the desktop.
What is the question mark used for? I looked up the use of % and the
glossary says it returns the modulus. I don't understand why I would
want the modulus of anything.
I like the idea of text = text because it allows me to more easily
change my text. 
As long as I put text = Your Score is :  + str( Game.score_value) the
program works fine.
Sorry I need further help
Gene

-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of [EMAIL PROTECTED]
Sent: Tuesday, June 07, 2005 2:58 PM
To: tutor@python.org
Subject: Tutor Digest, Vol 16, Issue 21

Send Tutor mailing list submissions to
tutor@python.org

To subscribe or unsubscribe via the World Wide Web, visit
http://mail.python.org/mailman/listinfo/tutor
or, via email, send a message with subject or body 'help' to
[EMAIL PROTECTED]

You can reach the person managing the list at
[EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than Re: Contents of Tutor digest...


Today's Topics:

   1. repr() (Bernard Lebel)
   2. Re: repr() (Max Noel)
   3. Re: Text problem (Kent Johnson)
   4. Re: repr() (Danny Yoo)
   5. Re: More image manipulation (Terry Carroll)
   6. Re: repr() (Terry Carroll)
   7. Re: repr() (Bernard Lebel)
   8. Re: Trying Ruby... (Christian Wyglendowski)
   9. Re: More image manipulation (Terry Carroll)
  10. Re: repr() (Danny Yoo)
  11. Re: interactif or not (Alan G)
  12. Fwd:  More image manipulation (D. Hartley)


--

Message: 1
Date: Tue, 7 Jun 2005 15:42:39 -0400
From: Bernard Lebel [EMAIL PROTECTED]
Subject: [Tutor] repr()
To: tutor@python.org
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=ISO-8859-1

Hello,

Possibly I am missing something, but how do you use the repr() function?

I type this ultra-simple function:

def myFunc(): print 'hello'

Then run

repr( myFunc )

Wich returns

'function myFunc at 0x009C6630'


Okay then I run

s = repr( myFunc() )
print s

Wich returns

'None'


Thanks
Bernard


--

Message: 2
Date: Tue, 7 Jun 2005 20:50:51 +0100
From: Max Noel [EMAIL PROTECTED]
Subject: Re: [Tutor] repr()
To: Bernard Lebel [EMAIL PROTECTED]
Cc: tutor@python.org
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=US-ASCII; delsp=yes; format=flowed


On Jun 7, 2005, at 20:42, Bernard Lebel wrote:

 repr( myFunc )

 Wich returns

 'function myFunc at 0x009C6630'


 Okay then I run

 s = repr( myFunc() )
 print s

 Wich returns

 'None'

 That's perfectly normal. Your last assignment calls the  
function, then assigns to s the representation of the function's  
return value. A function that doesn't have a return statement returns  
None, and repr(None) == 'None'. Which is what you get.

-- Max
maxnoel_fr at yahoo dot fr -- ICQ #85274019
Look at you hacker... A pathetic creature of meat and bone, panting  
and sweating as you run through my corridors... How can you challenge  
a perfect, immortal machine?



--

Message: 3
Date: Tue, 07 Jun 2005 15:51:28 -0400
From: Kent Johnson [EMAIL PROTECTED]
Subject: Re: [Tutor] Text problem
Cc: tutor@python.org
Message-ID: [EMAIL PROTECTED]
Content-Type: text/plain; charset=windows-1252; format=flowed

EUGENE ASTLEY wrote:
 Python, pygames problem.
 
 At the end of my game, I go back to the desk top after displaying the 
 score of the player, as follows:
 
 Def game_over(self)
 
 Games.Message(screen = self.screen,
 
 X = 400, y = 400
 
 Text + ?Your Score is  ? + str(Game.score_value),
 
 Size = 60, color = color.green,
 
 Lifetime = 1000, after_death = self.screen.quit()
 
  
 
 This works well but I would like to have several lines of text. The 
 triple quote method does not work. How can I get several lines of text

 into the message?

It looks like you are using livewires and you have paraphrased your
code. It's helpful if you copy and paste the exact code you have tried
and any error message you get.

Looking at livewires.games.py I see

class Message(Text):

def __init__ (self, screen, x, y, text, size, color,
  a=0, dx=0, dy=0, da=0,
  lifetime=0, after_death=None):

so I would try something like this:

def gameOver(self):
   text = ?Your Score is  %s
Thank you for playing
Please come again? % Game.score_value
games.Message(x = 400, y = 400, text = text,
size = 60, color = color.green,
lifetime = 1000, after_death = self.screen.quit())

Kent



--

Message: 4
Date: Tue, 7 Jun 2005 13:25:15 -0700 (PDT)
From: Danny Yoo [EMAIL PROTECTED]
Subject: Re: [Tutor] repr()
To: Bernard 

[Tutor] Just a Python formatting question

2005-06-08 Thread Kristiano Ang
Hey guys,
  I'm pretty new to Python (using Mac Python 2.4.1) and have a
question with formatting that I hope you can help me with.

  Sometimes, when I write code with Python (copied off tuts.), I get
error messages and highlights of the word else. Take for example:

#plays the guessing game higher or lower

#originally written by Josh Cogliati, improved by Quique and copied by
Kristiano Ang

number=78
guess=0

while guess != number:
guess=input (Guess a number:)
if guess  number:
print Too High
elif guess  number:
print Too low

 print Just right


I just can't get it to run and I get some indentation error.

  I'm pretty new to this so I'm sorry if this question(s) sound(s)
amateurish. Do help.

Thanks.
-Kristiano Ang
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Just a Python formatting question

2005-06-08 Thread Ertl, John
Kristiano,

It is sometimes hard to tell the indentions in an email but it looks like
your last line

 print Just right

has a space in front of it.  Python does not know what logical block the
indented part belongs to.

John Ertl 

-Original Message-
From: Kristiano Ang [mailto:[EMAIL PROTECTED]
Sent: Wednesday, June 08, 2005 09:49
To: tutor@python.org
Subject: [Tutor] Just a Python formatting question

Hey guys,
  I'm pretty new to Python (using Mac Python 2.4.1) and have a
question with formatting that I hope you can help me with.

  Sometimes, when I write code with Python (copied off tuts.), I get
error messages and highlights of the word else. Take for example:

#plays the guessing game higher or lower

#originally written by Josh Cogliati, improved by Quique and copied by
Kristiano Ang

number=78
guess=0

while guess != number:
guess=input (Guess a number:)
if guess  number:
print Too High
elif guess  number:
print Too low

 print Just right


I just can't get it to run and I get some indentation error.

  I'm pretty new to this so I'm sorry if this question(s) sound(s)
amateurish. Do help.

Thanks.
-Kristiano Ang
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] #3 Text problem

2005-06-08 Thread Alan G

 Subject: [Tutor] FW: Tutor Digest, Vol 16, Issue 21, #3 Text problem

Its best not to reply to the list digest header mail!
If for no other reason than the fact you send the whole
digest out with your mail which isn't very friendly
for those still using slow dial up!

:-)

 I tried your suggestion but it does not work for me. I get a syntax
 error at use of the first question mark when trying it in Idle.
 When I try it from the desktop, it just flashes a black screen and
 returns me to the desktop.

Try adding a line:

raw_input('Hit enter to quit')

at the end of your program. It sounds like its running and exiting
before you can reads it!


 What is the question mark used for? I looked up the use of % and the
 glossary says it returns the modulus.

Thats one use but its also used for interpolating text into strings as
in:

s = 'A string with the number %d in it % 42

s now contains 'A string with the number 42 in it'

So the % inserts the 42 at the position marked by %d (where d=decimal
digit)
You can insert other type values too. This is known as a format
string,
try searching the help for that.

 I don't understand why I would want the modulus of anything.

Modulus (ie remainder part of an integer division) is very useful for
all sorts ofthings in programming, I'd be surprised if you never found
a use for it! :-)

Alan G.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] long int in list as argument for seek() function

2005-06-08 Thread lmac
Hi there,
i want to use an long int from an list which i got from my function 
find_lineno().
But i got this error and i don't understand why i can not use this long 
as an argument.
Where do i find a good documentation on errors so that i complete 
understand what
the heck is going on.
Many thanks.

ERROR:
---
Traceback (most recent call last):
  File ./extrmails.py, line 42, in ?
inputfile.seek(0,li)
IOError: [Errno 22] Invalid argument
---


CODE-START:
-

inputfile=open(mails,rt)

# --
def reset_inputfile():
inputfile.seek(0,0)

# --
def find_lineno(string):
f = -1
a = start
found_lines = []
reset_inputfile()

while len(a) != 0:
a = inputfile.readline()
f = a.find(string)
if f != -1:
found_lines.append(inputfile.tell())

return found_lines

# --

from_lineno=find_lineno(From:)
subj_lineno=find_lineno(Subject:)

print len(subj_lineno)
print len(from_lineno)

reset_inputfile()

for li in subj_lineno:   
inputfile.seek(0,li)-- ??? 
...
..
--
CODE-END

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Text problem

2005-06-08 Thread Kent Johnson
EUGENE ASTLEY wrote:
 I tried your suggestion but it does not work for me. I get a syntax
 error at use of the first question mark when trying it in Idle.
 When I try it from the desktop, it just flashes a black screen and
 returns me to the desktop.
 What is the question mark used for? 

Somehow the text was garbled. In the quote below it shows question mark, quote, 
quote and quote, quote, question mark. In both places it should be quote, 
quote, quote - a triple-quoted string.

Kent

 def gameOver(self):
text = ?Your Score is  %s
 Thank you for playing
 Please come again? % Game.score_value
 games.Message(x = 400, y = 400, text = text,
 size = 60, color = color.green,
 lifetime = 1000, after_death = self.screen.quit())

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] long int in list as argument for seek() function

2005-06-08 Thread Kent Johnson
lmac wrote:
 Hi there,
 i want to use an long int from an list which i got from my function 
 find_lineno().
 But i got this error and i don't understand why i can not use this long 
 as an argument.

You have the arguments to file.seek() reversed.

 Where do i find a good documentation on errors so that i complete 
 understand what
 the heck is going on.

From http://docs.python.org/lib/bltin-file-objects.html
seek(   offset[, whence])
Set the file's current position, like stdio's fseek(). The whence argument 
is optional and defaults to 0 (absolute file positioning); other values are 1 
(seek relative to the current position) and 2 (seek relative to the file's 
end). 

Kent

 Many thanks.
 
 ERROR:
 ---
 Traceback (most recent call last):
   File ./extrmails.py, line 42, in ?
 inputfile.seek(0,li)
 IOError: [Errno 22] Invalid argument
 ---
 
 
 CODE-START:
 -
 
 inputfile=open(mails,rt)
 
 # --
 def reset_inputfile():
 inputfile.seek(0,0)
 
 # --
 def find_lineno(string):
 f = -1
 a = start
 found_lines = []
 reset_inputfile()
 
 while len(a) != 0:
 a = inputfile.readline()
 f = a.find(string)
 if f != -1:
 found_lines.append(inputfile.tell())
 
 return found_lines
 
 # --
 
 from_lineno=find_lineno(From:)
 subj_lineno=find_lineno(Subject:)
 
 print len(subj_lineno)
 print len(from_lineno)
 
 reset_inputfile()
 
 for li in subj_lineno:   
 inputfile.seek(0,li)-- ??? 
 ...
 ..
 --
 CODE-END
 
 ___
 Tutor maillist  -  Tutor@python.org
 http://mail.python.org/mailman/listinfo/tutor
 

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] keylogger

2005-06-08 Thread Liam Clarke
I still want to know why you want to write one, however.On 6/9/05, Vladimir Rasputin [EMAIL PROTECTED]
 wrote:No i was just wondering which language would be a good one to make a
keylogger with. Could you reconmend the one that would be the easiest?From: Liam Clarke [EMAIL PROTECTED]Reply-To: Liam Clarke 
[EMAIL PROTECTED]To: Vladimir Rasputin [EMAIL PROTECTED]CC: tutor@python.orgSubject: Re: [Tutor] keylogger
Date: Wed, 8 Jun 2005 21:24:25 +1200Out of curiosity, why the interest in logging keys?I'm also pretty sure that a Python programme couldn't run as quietly asmostkeyloggers tend to...
On 6/8/05, Vladimir Rasputin [EMAIL PROTECTED] wrote:   Can i make a keylogger using python?  has anyone ever made one/tryed to make one?
  does any one know how to make one?   _  Express yourself instantly with MSN Messenger! Download today it's FREE!
  http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/   ___
  Tutor maillist - Tutor@python.org  http://mail.python.org/mailman/listinfo/tutor 
--'There is only one basic human right, and that is to do as you damn wellplease.And with it comes the only basic human duty, to take the consequences.'_
FREE pop-up blocking with the new MSN Toolbar - get it now!http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/
-- 'There is only one basic human right, and that is to do as you damn well please.And with it comes the only basic human duty, to take the consequences.'
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] remove from python

2005-06-08 Thread Lee Harr

how can i get my email address removed, I'm receiving way too many
emails



You have a few options. You may want to see if just turning the Tutor
mailing list setting to Digest Mode might help. You can do this
through:
http://mail.python.org/mailman/options/[EMAIL PROTECTED]



Personally, I find the Digest a bit harder to use, so I just use my gmail
account for the list, and use filters to automatically tag the Python list



I am not a big digest fan either. I prefer to read as a newsgroup
through the gmane news server:
http://gmane.org/

_
FREE pop-up blocking with the new MSN Toolbar – get it now! 
http://toolbar.msn.click-url.com/go/onm00200415ave/direct/01/


___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor