2

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?

2
  • 1
    Don't have it be a list. That's it. Commented Feb 3, 2012 at 14:28
  • did you want print ' '.join(bench.cmd)? Commented Feb 3, 2012 at 14:29

4 Answers 4

3

Try: print ' '.join(bench.cmd). This joins the list and uses a space as delimiter

Sign up to request clarification or add additional context in comments.

Comments

2

You could do ' '.join(bench.cmd).

Comments

0

case for join: ' '.join(bench.cmd)

1 Comment

@user1180720 for some reason that caused me to choke on my drink. Thanks.
0

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.