converting from shell script to python
hal_wine at yahoo.com
Tue Apr 1 19:32:13 CEST 2003
William Park wrote:
> Shao Zhang <shao at cia.com.au> wrote:
>>I need to convert a very simple shell script to python in order get it
>>run on both windows and unix. However I cannot quite work out a simple
Which means that the class path needs to look like a normal file
path on each platform. Which, afaik, _does_ mean using
os.path.join and os.pathsep
As 'elegant' as I can get is
ROOTDIR = r'c:\lib'
JARS = ( ('a', 'a.jar'),
CLASSPATH = os.pathsep.join(
map(lambda x: os.path.join( ROOTDIR, *x ), JARS) )
os.system( 'java -classpath %s foo' % (CLASSPATH) )
>>Will perl be a better
>>choice for things like this?
Not IMO -- it's harder to find the equivalent of os.pathsep...
More information about the Python-list