one command on backslash and space for review

Ganesh Pal ganesh1pal at gmail.com
Sun Jul 10 11:19:14 EDT 2016


Hello Team,

I am on python 2.7 and  Linux , I  want to  form the below sample
command so that I could run it on the shell.

Command is --> run_parallel -za1 -s 'daemon -cf xyz; sleep 1'

Here is how I formed the command and it seems to look fine and work
fine , but I think it could still be better any idea ?

>>> cmd = "run_parallel -za" + str(number) + \
...       " -s" + " \'daemon -cf xyz; sleep 1\'"
>>> cmd
"run_parallel -za1 -s 'daemon -cf xyz; sleep 1'"
>>>

Looking for thoughts around:

1. If backslash are syntactically  correct

2.  " -s" , starting with a leading space , may be its not a good idea
, other ways

3. Iam running sleep command on the cluster i.e , how could I make it
look Python or its fine to have sleep ?

Regards,

Ganesh



More information about the Python-list mailing list