(gulp) newbie question - portablity of python
thomas at xs4all.net
Sun May 14 20:51:55 CEST 2000
On Sun, May 14, 2000 at 06:42:51PM +0000, Keygrass wrote:
[ about python portability ]
> So ... my question is this: Is this really too good to be true? What I want
> to do it write the program on my Win98se (at home) and then use that .exe
> or .bat file (or whatever extension it is) at work which uses unix.
Well, yes and no. If you do not rely on platform-specific extensions (like
the Windows COM stuff, or the functionality of fork(), or the posix module)
your code will run on many, if not all, platforms. The file will have the
'.py' extension, though, and you need to do some magic to make it into a
.bat file (see the FAQ for that, i believe) and even more magic to make it
into a .exe file.
> Basically, I want a build a program that will replace words and number on
> another file. For example, if I had a file called "Outdoor_sports" that
> contained the word "baseball bat", I would want my program to change it so
> it would say "football".
This is entirely possible and pretty simple, as long as it's a text file. If
you are working with Word-files or Excel sheets or some such, you'll have a
tad more trouble. But, honesty compels me to say, you can do the same in
Perl, with more or less the same effort (depending on wether you get along
If you wonder how, well, take a look at the 'string' and the 'fileinput'
modules. 'string.replace' is probably what you want.
Thomas Wouters <thomas at xs4all.net>
Hi! I'm a .signature virus! copy me into your .signature file to help me spread!
More information about the Python-list