Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #111262

Re: one command on backslash and space for review

From Ganesh Pal <ganesh1pal@gmail.com>
Newsgroups comp.lang.python
Subject Re: one command on backslash and space for review
Date 2016-07-11 10:19 +0530
Message-ID <mailman.177.1468212550.2295.python-list@python.org> (permalink)
References <CACT3xuWi-BTNM2QRe3Gdk4ZyqyFn-m0U-RNPxJXS2sgMd55ciA@mail.gmail.com> <CALwzidk1Z30Q9RiLQgcM50+o_jDx-yVYcB7mnEH2KNfbaCg8zw@mail.gmail.com> <CACT3xuW2xjbApThg59vwSTeiC6fQmF0YjhNteaxWNNBkqoxaeg@mail.gmail.com>

Show all headers | View raw


>
>
>
> >>>> cmd = "run_parallel -za" + str(number) + \
> > ...       " -s" + " \'daemon -cf xyz; sleep 1\'"
>
> cmd = "run_parallel -za{} -s 'daemon -cf xyz; sleep 1'".format(number)
>
>
How will I format number to strings  using .format ??

Example

>>> str(num)

'100'

>>> cmd = "run_parallel -za{} -s 'daemon -cf xyz; sleep 1'".format(str(num))

>>> cmd

"run_parallel -za100 -s 'daemon -cf xyz; sleep 1'“.

Will Something like format(str(num)) work ? it working though


Regards,

Ganesh

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: one command on backslash and space for review Ganesh Pal <ganesh1pal@gmail.com> - 2016-07-11 10:19 +0530

csiph-web