title: How to print a string at a fixed width?
body: <p>I have this code (printing the occurrence of the all permutations in  a string)</p>
  
  <pre><code>def splitter(str):
      for i in range(1, len(str)):
          start = str[0:i]
          end = str[i:]
          yield (start, end)
          for split in splitter(end):
              result = [start]
              result.extend(split)
              yield result    
  
  el =[];
  
  string = "abcd"
  for b in splitter("abcd"):
      el.extend(b);
  
  unique =  sorted(set(el));
  
  for prefix in unique:
      if prefix != "":
          print "value  " , prefix  , "- num of occurrences =   " , string.count(str(prefix));
  </code></pre>
  
  <p>I want to print all the permutation occurrence there is in string varaible.</p>
  
  <p>since the permutation aren't in the same length i want to fix the width and print it in a nice not like this one:</p>
  
  <pre><code>value   a - num of occurrences =    1
  value   ab - num of occurrences =    1
  value   abc - num of occurrences =    1
  value   b - num of occurrences =    1
  value   bc - num of occurrences =    1
  value   bcd - num of occurrences =    1
  value   c - num of occurrences =    1
  value   cd - num of occurrences =    1
  value   d - num of occurrences =    1
  </code></pre>
  
  <p>How can I use <code>format</code> to do it? </p>
  
  <p>I found these posts but it didn't go well with alphanumeric strings:</p>
  
  <p><a href="https://stackoverflow.com/questions/8424474/python-string-formatting-fixed-width">python string formatting fixed width</a></p>
  
  <p><a href="https://stackoverflow.com/questions/5138062/setting-fixed-length-with-python">Setting fixed length with python</a></p>