今天写程序,想输出一个array的shape,原程序为: print('shape of testUImatrix:%s\nStart to make testUImatrix...'%(testuimat.shape)) 结果报错: TypeError: not all arguments converted during string formatting 这句话有什么问题嘛??感觉有点奇怪,之后google到了这个网页https://segmentfault.com/q/101000000…
今天使用mysqldb执行query语句的时候,在执行这条语句的时候: select PROJ, DATE_FORMAT(MAX(DATE),'%Y-%m-%') AS MAXDATE, DATE_FORMAT(MIN(DATE),'%Y-%m-%d') AS MINDATE FROM (SELECT resource.PROJ,`day`.DATE FROM resource,`day` where resource.MAC=`day`.MAC ORDER BY PROJ) AS PROJSE…
今天使用字符串格式化时,遇到的一点小问题:调用这个方法解释器出错了:TypeError: not enough arguments for format string def ll(name,age): print('name:%s,age:%s' %name, age) ll('huhu',18) 运行结果: File "D:/python/pylib.py", line 69, in ll print('name:%s,age:%s' %name, age) TypeError:…
query = "SELECT * FROM devices WHERE devices.`id` LIKE '%{}%'".format("f2333") datas = cur.query(query) 报错: query = query % tuple([db.literal(item) for item in args]) TypeError: not enough arguments for format string 传入query语句拼接出来为 SEL…