title: Python iteration
body: <p>I'm trying to do a simple script in Python that will print hex values and increment value like this:</p>
  
  <pre><code> char = 0
   char2 = 0
  
   def doublehex():
      global char,char2
      for x in range(255):
          char = char + 1
          a = str(chr(char)).encode("hex")
          for p in range(255):
             char2 = char2 + 1
             b = str(chr(char2)).encode("hex")
             c = a+" "+b
             print "testing with:%s"%(c)
  doublehex()
  </code></pre>
  
  <p>Output: </p>
  
  <pre><code>testing with:01 01
  testing with:01 02
  testing with:01 03
  [snip]
  testing with:01 fd
  testing with:01 fe
  testing with:01 ff
  
  Traceback (most recent call last):
    File "test2.py", line 16, in doublehex
     b = str(chr(char2)).encode("hex")
  ValueError: chr() arg not in range(256)
  </code></pre>
  
  <p>Actually what I'm trying to do is:</p>
  
  <pre><code>01 01
  01 02
  [snip]
  01 ff
  02 01
  02 02
  </code></pre>
  
  <p>And so on, until <code>ff ff</code>. What's wrong in my script?</p>
  
  <p>Also it seems I can't try:</p>
  
  <pre><code>00 01
  00 02
  </code></pre>
  
  <p>I don't know why.</p>