[Tutor] replace string in a sequentially read stream

2005-09-12 Thread János Juhász
Dear Guys, I have to run the next regexp change in a stream: import re wrongcode = re.compile(r'(.*)b24704T') f = open('testfile.txt') while 1: sequence = f.read(1024) sequence = wrongcode.sub(r'\1b24700T', sequence) print sequence My original solution was to keep the last p

[Tutor] upgrading from 2.3 to 2.4.1 on Mandrake Linux 10.1

2005-09-12 Thread Andy Dani
Hi, Which is the best location to install Python in Linux? Should it be under one directory or different (like lib, doc, bin etc.)? I followed installation instructions in "inst.pdf" from python documents. I can see that Python 2.4.1 has been installed in /user/lib/local by standard installati

Re: [Tutor] hey i need some help here

2005-09-12 Thread Alan G
>I just started attempting to program and thought i would try python >as my > first tool. However following the beginners guide on their page it > says to insert python as a command and that it should come up with > the program information. Have you downloaded Python and installed yet? You nee

[Tutor] Partly OT: order of renaming files and directories

2005-09-12 Thread Bernard Lebel
Hello, I'm creating a script that will rename directories and files (hence the regular expression thing I asked about last week). I just wanted to ask if there is a recommended order to rename stuff, because I want to avoid any potential problem. What I mean: I traverse some areas of the file ser

Re: [Tutor] Partly OT: order of renaming files and directories

2005-09-12 Thread Kent Johnson
Bernard Lebel wrote: > Hello, > > I'm creating a script that will rename directories and files (hence > the regular expression thing I asked about last week). I just wanted > to ask if there is a recommended order to rename stuff, because I want > to avoid any potential problem. > > What I mean:

Re: [Tutor] directory recursion

2005-09-12 Thread Rob Andrews
Thanks! That did the trick after very modest head scratching. -Rob On 9/9/05, Danny Yoo <[EMAIL PROTECTED]> wrote: > > > > What's a nice, clean way to recursively scan through directories with > > an arbitrary number of subdirectories? > > Hi Rob, > > You may want to look at os.walk():

Re: [Tutor] Partly OT: order of renaming files and directories

2005-09-12 Thread Bernard Lebel
Thanks Kent! Bernard On 9/12/05, Kent Johnson <[EMAIL PROTECTED]> wrote: > Bernard Lebel wrote: > > Hello, > > > > I'm creating a script that will rename directories and files (hence > > the regular expression thing I asked about last week). I just wanted > > to ask if there is a recommended ord

Re: [Tutor] upgrading from 2.3 to 2.4.1 on Mandrake Linux 10.1

2005-09-12 Thread Michael Lange
On Mon, 12 Sep 2005 07:35:52 -0500 "Andy Dani" <[EMAIL PROTECTED]> wrote: > Hi, > > Which is the best location to install Python in Linux? Should it be under one > directory or different (like lib, doc, bin etc.)? > > I followed installation instructions in "inst.pdf" from python documents. I

Re: [Tutor] mamelauncher

2005-09-12 Thread Max Russell
I've tried running that function, with a little Main method like this: import os def run_mame_selection(selection): os.system("C:\\mame096b\\mame.exe"+""+selection) #main mine = "pacman" run_mame_selection(mine) What I get is like a brief flash of the CMD prompt like it is trying it and

[Tutor] Python coding

2005-09-12 Thread tuvas
I am working on a project that we have built a C Text interface previously. We want to be able to move this to a graphical interface, and after some studying, we decided to use a python-based interface. We want to use as much of the old code as possible, so we have decided to try an interface with

Re: [Tutor] Python coding

2005-09-12 Thread Eric Walker
I think there is some software out there call SWIG that will create an interface to your C code within python... On Monday 12 September 2005 01:59 pm, [EMAIL PROTECTED] wrote: > I am working on a project that we have built a C Text interface previously. > We want to be able to move this to a gr

Re: [Tutor] mamelauncher

2005-09-12 Thread Alan G
> import os > > def run_mame_selection(selection): >os.system("C:\\mame096b\\mame.exe"+""+selection) > > #main > mine = "pacman" > run_mame_selection(mine) > > What I get is like a brief flash of the CMD prompt Open the command prompt first and run it from there. (Or add a raw_input() l

Re: [Tutor] Python coding

2005-09-12 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > I am working on a project that we have built a C Text interface previously. We > want to be able to move this to a graphical interface, and after some > studying, > we decided to use a python-based interface. We want to use as much of the old > code as possible, so we ha

Re: [Tutor] mamelauncher

2005-09-12 Thread Danny Yoo
On Mon, 12 Sep 2005, Alan G wrote: > > def run_mame_selection(selection): > >os.system("C:\\mame096b\\mame.exe"+""+selection) Hi Max, If you're getting really stuck here, skip below for a hint. Hint: in the defintion of run_mame_selection, there's some string concatenation going on he

[Tutor] Download an image of a site?

2005-09-12 Thread Joseph Quigley
Hi, I'm a Garfield fan and I thought that I'd make a program that would enable me to read the online comics without opening firefox and typing the url and waiting for all the other junk to load. Here's my code: # import modules import time import urllib2 class data: # Define time and date

[Tutor] Annoying problem when importing a file (caused by IDLE?)

2005-09-12 Thread Gregor Lingl
Hi pythonistas! Recently I've encountered a very annoying problem when developing a program - more exactly a module - of several hundred lines using Idle. Of course I have a __name__=="__main__" section to test my classes, which ran successfully every time, (except when there were bugs :-( in t

Re: [Tutor] Download an image of a site?

2005-09-12 Thread Joseph Quigley
ZIYAD A. M. AL-BATLY wrote: >Since you're running some kind of Unix (maybe Linux or FreeBSD), all >these command are available for you. By commands I mean: "cron", >"wget", and "date". > > > Wow. That's a good idea.. however this is a "gift" for someone who wants me to make a program to do it

[Tutor] Boa-Constructor

2005-09-12 Thread Terry Kemmerer
Hey Guys, I am trying to pick an IDE, and it seems to me that Boa-Constructor has great potential. However, in searching google looking to see what others have said, I am reading that the latest version of Boa-Constructor is unstable at best and crashes a lot.being said, at least, by those

Re: [Tutor] Boa-Constructor

2005-09-12 Thread nephish
Terry Kemmerer wrote: > Hey Guys, > > I am trying to pick an IDE, and it seems to me that Boa-Constructor > has great potential. However, in searching google looking to see what > others have said, I am reading that the latest version of > Boa-Constructor is unstable at best and crashes a lot..

Re: [Tutor] Download an image of a site?

2005-09-12 Thread Joseph Quigley
ZIYAD A. M. AL-BATLY wrote: >Since you're running some kind of Unix (maybe Linux or FreeBSD), all >these command are available for you. By commands I mean: "cron", >"wget", and "date". > > > Wow. That's a good idea.. however this is a "gift" for someone who wants me to make a program to do it

Re: [Tutor] Download an image of a site?

2005-09-12 Thread Kent Johnson
Joseph Quigley wrote: > Hi, > I'm a Garfield fan and I thought that I'd make a program that would > enable me to read the online comics without opening firefox and typing > the url and waiting for all the other junk to load. Here's my code: > > # import modules > import time > import urllib2 > >

[Tutor] Boa-Constructor

2005-09-12 Thread Terry Kemmerer
Nephish, I run Mandriva Linux with Gnome, but also have the KDE desktop set up as one of my optional desktops that I can log into for a session, and in fact, I do run a lot of KDE stuff on gnome, like Konqueror, etc. I urpmi-ed Eric and will check it out. Thanks! I liked the idea of Boa-Con

[Tutor] Where did those spaces come from?

2005-09-12 Thread Tom Tucker
Tutor, Good evening!    The goal is to parse a simple file and grab column one.  Then print each value horizontally separated by a comma. Why is Python adding a space padding between each value?   Please see below. Thanks ahead of time. INPUT_FILE # unwanted lines removed ##

Re: [Tutor] Where did those spaces come from?

2005-09-12 Thread Danny Yoo
On Mon, 12 Sep 2005, Tom Tucker wrote: > Good evening! The goal is to parse a simple file and grab column one. > Then print each value horizontally separated by a comma. Why is Python > adding a space padding between each value? Please see below. Thanks > ahead of time. Hi Tom, The 'print' s

Re: [Tutor] Boa-Constructor

2005-09-12 Thread Hugo González Monteverde
Also SPE is great. http://www.stani.be/python/spe/blog/ Hugo Terry Kemmerer wrote: > Hey Guys, > > I am trying to pick an IDE, and it seems to me that Boa-Constructor has > great potential. However, in searching google looking to see what others > have said, I am reading that the latest versi