Need help on left padding

Discussion in 'Python' started by rajesh kataraki, Apr 28, 2008.

  1. Hello,

    My requirement is I am using one variable ex. var = 5 which is
    integer.
    And this variable, I m using in some string. But I want this var
    to be used as 005 again integer in this string.

    The snippet of string is as follows:

    container_name = "%s-%d-dso-%s.so" % (platform_affix,var, rteset)


    Please let me know how can I implement this efficiently in python
    language.

    Need help urgent.

    Thanks,
    -Rajesh
    rajesh kataraki, Apr 28, 2008
    #1
    1. Advertising

  2. On Mon, 28 Apr 2008 04:37:02 -0700, rajesh kataraki wrote:

    > My requirement is I am using one variable ex. var = 5 which is
    > integer.
    > And this variable, I m using in some string. But I want this var
    > to be used as 005 again integer in this string.


    In [22]: '%03d' % 5
    Out[22]: '005'

    Ciao,
    Marc 'BlackJack' Rintsch
    Marc 'BlackJack' Rintsch, Apr 28, 2008
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Dave
    Replies:
    7
    Views:
    5,639
    Joe Smith
    Jul 22, 2004
  2. RA
    Replies:
    1
    Views:
    359
  3. Ike

    left-padding ints

    Ike, Sep 7, 2005, in forum: Java
    Replies:
    3
    Views:
    6,028
  4. chlori

    padding-left

    chlori, Jul 5, 2003, in forum: HTML
    Replies:
    6
    Views:
    3,453
    Jacqui or (maybe) Pete
    Jul 6, 2003
  5. =?iso-8859-1?q?Jean-Fran=E7ois_Michaud?=

    Help on table align on left of page vs left hanging indent

    =?iso-8859-1?q?Jean-Fran=E7ois_Michaud?=, Jul 10, 2007, in forum: XML
    Replies:
    2
    Views:
    978
    =?iso-8859-1?q?Jean-Fran=E7ois_Michaud?=
    Jul 16, 2007
Loading...

Share This Page