title: Python - Error output with print function
body: <p>I'm new to Python.
  I want to print elements in the list without duplicate in a specific format: {"id": value}. 
  Here is my code. </p>
  
  <pre><code>d =['l','o','u','l','b','l','a']
  
  for item in range(0,len(d)):
    prev=item-1
    if item==0:
      print("  {\"id\": \"" + (d[item]) + "\"} ,") 
      continue
    if (d[item]==d[prev])or(d[item] in d[:prev]):
      continue
    else:
      print("  {\"id\": \"" + (d[item]) + "\"}"),
      if (item==(len(d))): #if last element, print  ".", else print ","
          print(".\n"),
      else:
          print(",\n"),
  </code></pre>
  
  <p>The result should be:</p>
  
  <pre><code>  {"id": "l"} ,
    {"id": "o"} ,
    {"id": "u"} ,
    {"id": "b"} ,
    {"id": "a"} .
  </code></pre>
  
  <p>But the output is:</p>
  
  <pre><code>  {"id": "l"} ,
    {"id": "o"} ,
    {"id": "u"} ,
    {"id": "b"} ,
    {"id": "a"} ,
  </code></pre>
  
  <p>My code works well until the last line. It ends with "," instead of ".". 
  Please help me</p>