title: python how to judge whether a variable is boolean type
body: <p>In python, how to judge whether a variable is bool type,python 3.6 using</p>
  
  <pre><code>    for i in range(len(data)):
          for k in data[i].keys():
              if type(data[i][k]) is types.BooleanType:
                  data[i][k] = str(data[i][k])
              row.append(data[i][k])
              #row.append(str(data[i][k]).encode('utf-8'))
          writer.writerow(row)
          row = []
  </code></pre>
  
  <p>but it errors:</p>
  
  <pre><code>  if type(data[i][k]) is types.BooleanType:
  
    TypeError: 'str' object is not callable
  </code></pre>