无法解析类型' Nonetype'没有len

时间:2014-03-28 06:02:18

标签: python matplotlib sqlite

我想在Platform和Build之间为那些具有Pass Value的值绘制一个图形。以下是我的代码:

import matplotlib.pyplot as plt
import pandas
import pylab
import sqlite3

conn = sqlite3.connect('automate12.db')
cursor = conn.cursor()
cursor.execute("""CREATE TABLE automate13(branch INTEGER,Platform VARCHAR(50),result VARCHAR(50),build                 INTEGER) """)

multiple_values = [(13,' Windows',' Pass',12),(14,' Solaris'' Pass' ,16),(15,' Mac',' Pass',20),(16,' WindowsXP',' Pass',24 ),(17,' Windows Vista',' Pass',28),(18,' Linux','失败',32) ]

conn.executemany("INSERT INTO automate13(branch,Platform,result,build)VALUES(?, ?, ?, ?)",  multiple_values)
conn.row_factory = sqlite3.Row
curs = conn.cursor()
query = """SELECT Platform,build FROM automate13 WHERE result='pass';"""
curs.execute(query)

def func():
      for row in curs:
          global Platform
          Platform.append(row['Platform'])
          return Platform

def func1():
     for row in curs:
          global Build
          Build.append(row['build'])
          return Build

pylab.figure(1)
x = range(10)
func()
pylab.xticks(x,func())
pylab.plot(x,func1(),"g")
pylab.show()
conn.close()

我收到错误,'对象类型' NoneType'没有len()。即使我在这里看到过类似的问题,我也无法解决。

0 个答案:

没有答案