老猿Python博文目录 专栏:使用PyQt开发图形界面Python应用 老猿Python博客地址 在使用QTableView来显示如下数据时: 在model中插入数据是使用如下类似代码: for col in range(0, linelen): data = line[col] item = QStandardItem(data) self.excelModel.setItem(lineNO, col , item) 发现第一列之后的数据不能正常显示,如图: 跟踪未发现程序有错误. 最后确认
Python的字符串格式化有两种方式: 百分号方式.format方式 百分号的方式相对来说比较老,而format方式则是比较先进的方式,企图替换古老的方式,目前两者并存.[PEP-3101] This PEP proposes a new system for built-in string formatting operations, intended as a replacement for the existing '%' string formatting operator. 1.百分号
python提供了一些有趣且实用的函数,如any all zip,这些函数能够大幅简化我们得代码,可以更优雅的处理可迭代的对象,同时使用的时候也得注意一些情况 any any(iterable) Return True if any element of the iterable is true. If the iterable is empty, return False 如果序列中任何一个元素为True,那么any返回True.该函数可以让我们少些一个for循环.有两点需要注意 (1)如