[Tutor] Controlling MS Windows programs?

2007-10-03 Thread Fast Primes
I am looking for ways to control multiple Windows programs from Python, such that I can enter data via Python and have that data passed to an underlying third party program's GUI screen, operated on and the results possibly passed back to Python. Thence onto yet another program for further work

[Tutor] Timers in Python

2007-10-03 Thread Kamal
hello everyone, Is there a method in Python which does what setInterval('someFunction()',5000) does in Javascript. Basically, I want to call functionOne() every x minutes, and wondering whats the best way to do it. -- Thanks, Kamal ___ Tutor maillist

Re: [Tutor] matching a street address with regular expressions

2007-10-03 Thread John Fouhy
On 04/10/2007, Christopher Spears <[EMAIL PROTECTED]> wrote: > Obviously, I can just create a pattern "\d+ \w+ \w+". > However, the pattern would be useless if I had a > street name like 3120 De la Cruz Boulevard. Any > hints? Possibly you could create a list of street types ('Street', 'Road', 'C

[Tutor] matching a street address with regular expressions

2007-10-03 Thread Christopher Spears
One of the exercises in Core Python Programming is to create a regular expression that will match a street address. Here is one of my attempts. >>> street = "1180 Bordeaux Drive" >>> patt = "\d+ \w+" >>> import re >>> m = re.match(patt, street) >>> if m is not None: m.group() ... '1180 Bordeaux'

Re: [Tutor] creating the equivalent of string.strip()

2007-10-03 Thread Christopher Spears
I know people might be sick of this thread by now, but I decided to post a solution to this problem that uses regular expressions. #!/usr/bin/env python import string import re def my_strip(s): remove_leading = re.sub(r'^\s+','',s) remove_trailing = re.sub(r'\s+$','',remove_leading)

Re: [Tutor] creating the equivalent of string.strip()

2007-10-03 Thread Ricardo Aráoz
Alan Gauld wrote: > "Ricardo Aráoz" <[EMAIL PROTECTED]> wrote > >>> It still won't work. Strings are immutable, you can't use del >>> to delete a character. Try it. >> It comes straight from Idle (still warm ;-) ). >> Notice s = list(s) > > Shame and embarrassment! I read that code through both t

Re: [Tutor] Tkinter text

2007-10-03 Thread max baseman
sorry, what i was trying to say was, how would i write something that at first tries to create a hidden file on a apple computer then if the computer was not a apple creates a hidden file on a windows OS i have slowly been reading your tutorial and it's really one of the best tuts i've ever

Re: [Tutor] Tkinter text

2007-10-03 Thread Alan Gauld
"max baseman" <[EMAIL PROTECTED]> wrote > i've got two questions, 1st how would you go about creating a hidden > text file that trys on a apple and if that does not work tries to do > it on a windows computer? I don;t undeetabnd this bit. What does the text file try on the Apple/Windows computer

Re: [Tutor] creating the equivalent of string.strip()

2007-10-03 Thread Alan Gauld
"Ricardo Aráoz" <[EMAIL PROTECTED]> wrote > >It still won't work. Strings are immutable, you can't use del > > to delete a character. Try it. > > It comes straight from Idle (still warm ;-) ). > Notice s = list(s) Shame and embarrassment! I read that code through both times and never noticed the

Re: [Tutor] Sending Email

2007-10-03 Thread Steve Willoughby
On Wed, Oct 03, 2007 at 02:09:07PM -0700, Steve Willoughby wrote: > On Wed, Oct 03, 2007 at 05:02:52PM -0400, Kent Johnson wrote: > > One gotcha is that msg must also include From and Two headers. A > > slightly longer example is here: > > http://docs.python.org/lib/SMTP-example.html > > Yes, tha

Re: [Tutor] Sending Email

2007-10-03 Thread Steve Willoughby
On Wed, Oct 03, 2007 at 05:02:52PM -0400, Kent Johnson wrote: > One gotcha is that msg must also include From and Two headers. A > slightly longer example is here: > http://docs.python.org/lib/SMTP-example.html Yes, that's important to remember. Actually, you want to put all the headers you care

Re: [Tutor] Sending Email

2007-10-03 Thread Kent Johnson
Steve Willoughby wrote: > Python comes with an smtplib module which works very well. You say > you want plain text, so just do this: > > import smtplib > > mail = smtplib.SMTP(mailhost_name) > mail.sendmail(from_addr, to_addr, msg) > mail.quit() One gotcha is that msg must also include From a

Re: [Tutor] Sending Email

2007-10-03 Thread Steve Willoughby
On Wed, Oct 03, 2007 at 04:40:08PM -0400, Paul D. Kraus wrote: > I have a turbogears app that needs to be able to send out email > notifications to users. Just plain text, no attachments. Can anyone > suggest some lightweight module? > > Maybe something Akin to Perl's MIME::Lite. Python comes wit

[Tutor] Sending Email

2007-10-03 Thread Paul D. Kraus
I have a turbogears app that needs to be able to send out email notifications to users. Just plain text, no attachments. Can anyone suggest some lightweight module? Maybe something Akin to Perl's MIME::Lite. Paul ___ Tutor maillist - Tutor@python.org

Re: [Tutor] for a given file, how to find file size?

2007-10-03 Thread Kamal
Thanks Jason and Kent for the responses. On 10/3/07, Kent Johnson <[EMAIL PROTECTED]> wrote: > Kamal wrote: > > never mind found my answer here > > > > http://docs.python.org/lib/os-file-dir.html > > os.path.getsize() also works. > > Kent > -- Thanks, Kamal _

Re: [Tutor] for a given file, how to find file size?

2007-10-03 Thread Kent Johnson
Kamal wrote: > never mind found my answer here > > http://docs.python.org/lib/os-file-dir.html os.path.getsize() also works. Kent ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] for a given file, how to find file size?

2007-10-03 Thread Jason Massey
Are you sure? From the link you provided it looks as if: *stat*( path) Perform a stat() system call on the given path. The return value is an object whose attributes correspond to the members of the statstructure, namely: st_mode (protection bits), st_ino (inode number), st_dev (device), st_nlink

Re: [Tutor] data from excel spreadsheet to csv and manipulate

2007-10-03 Thread Kent Johnson
sacha rook wrote: > Hi > > can anyone help with the best way to tackle this? > > I have a spreadsheet ms excel, that has a name column that I want to > extract to csv and manipulate as follows. If you can save the spreadsheet as csv then you can use the csv module for reading and writing. T

[Tutor] data from excel spreadsheet to csv and manipulate

2007-10-03 Thread sacha rook
Hi can anyone help with the best way to tackle this? I have a spreadsheet ms excel, that has a name column that I want to extract to csv and manipulate as follows. The name column has data in this format Name Surname Firstname after extracting and manipulating I want it to be as follow

[Tutor] Tkinter text

2007-10-03 Thread max baseman
hello im working on my first simple gui using Tkinter i've got two questions, 1st how would you go about creating a hidden text file that trys on a apple and if that does not work tries to do it on a windows computer? the program I'm making is a vary simple text editor for one file all it ne

Re: [Tutor] creating the equivalent of string.strip()

2007-10-03 Thread Ricardo Aráoz
Ian Witham wrote: > > On 10/3/07, *Alan Gauld* <[EMAIL PROTECTED] > > wrote: > > > "Ricardo Aráoz" <[EMAIL PROTECTED] > wrote > > >sorry, forgot a piece of the code : > > > >s = list(s) > >while s[0].isspace() : > >

Re: [Tutor] creating the equivalent of string.strip()

2007-10-03 Thread Ricardo Aráoz
Alan Gauld wrote: > "Ricardo Aráoz" <[EMAIL PROTECTED]> wrote > >> sorry, forgot a piece of the code : >> >> s = list(s) >> while s[0].isspace() : >> while s[-1].isspace() : >> del s[-1] >> del s[0] >> s = ''.join(s) > > It still won't work. Strings are immutable, you can't use de

Re: [Tutor] newbie: Django suited for database driven web application?

2007-10-03 Thread cuongvt
Tnx for quick answer, I go for python and Django Kent Johnson wrote: > > cuongvt wrote: >> Hello >> I'm new to both Django and Python. I'm mainly developing on PHP. >> I tend to move to Django. But I want to confirm as below: >> I heard that Django is mainly used for something like content ma

Re: [Tutor] creating the equivalent of string.strip()

2007-10-03 Thread Ian Witham
On 10/3/07, Alan Gauld <[EMAIL PROTECTED]> wrote: > > > "Ricardo Aráoz" <[EMAIL PROTECTED]> wrote > > >sorry, forgot a piece of the code : > > > >s = list(s) > >while s[0].isspace() : > > while s[-1].isspace() : > > del s[-1] > > del s[0] > > s = ''.join(s) > > It still won't work.