Reputation: 24695
I passed an argument to a python script like -b bench
. The bench
is created like this:
bench_dir = '~/myFD/'
bench_bin = bench_dir + 'src/bin/Assembler'
bench_inp1 = bench_dir + 'input/in.fa'
bench_out1 = bench_dir + 'output/data.scratch'
bench= LiveProcess()
bench.executable = bench_bin
bench.cwd = bench_dir
bench.cmd = [bench.executable] + ['-s', bench_out1, '<', bench_inp1]
The bench.cmd
should looks like:
~/myFD/src/bin/Assembler -s ~/myFD/output/data.scratch < ~/myFD/input/in.fa
to do that, I use print bench.cmd
but it doesn't show the above statment correctly. Instead it shows:
['~/myFD/src/bin/Assembler', '-s', '~/myFD/output/data.scratch', ' < ', '~/myFD/input/in.fa']
how can I fix that?
Upvotes: 2
Views: 1320
Reputation: 49547
Are you looking for this,
>>> mylist = ['~/myFD/src/bin/Assembler', '-s', '~/myFD/output/data.scratch', ' < ', '~/myFD/input/in.fa']
>>> " ".join(mylist)
'~/myFD/src/bin/Assembler -s ~/myFD/output/data.scratch < ~/myFD/input/in.fa'
or just concatenate your strings
bench.cmd = bench.executable + ' -s ' + bench_out1 + ' < ' + bench_inp1
Upvotes: 0
Reputation: 2264
Try: print ' '.join(bench.cmd)
. This joins the list and uses a space as delimiter
Upvotes: 3