本文整理汇总了Python中File.File.size方法的典型用法代码示例。如果您正苦于以下问题:Python File.size方法的具体用法?Python File.size怎么用?Python File.size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类File.File
的用法示例。
在下文中一共展示了File.size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testInsert
# 需要导入模块: from File import File [as 别名]
# 或者: from File.File import size [as 别名]
def testInsert(self):
fdao = FileDAO()
file = File()
file.hash = self.hash
file.size = 555555
file.partialSize = 55555
file.bestname = 'nomedoarquivonarede.ext'
fid = fdao.insert(file)
assert fid != -1, 'error inserting file'
示例2: find
# 需要导入模块: from File import File [as 别名]
# 或者: from File.File import size [as 别名]
def find(self, id):
self.cursor.execute("""SELECT * FROM """+self.tablename+""" WHERE id = %s""", (id,))
rs = self.cursor.fetchall()
if not rs:
return None
file = File()
for row in rs:
file.id = row[0]
file.hash = row[1]
file.size = row[2]
file.partialSize = row[3]
file.bestName = row[4]
return file
示例3: findByHash
# 需要导入模块: from File import File [as 别名]
# 或者: from File.File import size [as 别名]
def findByHash(self, hash):
query = "SELECT * FROM %s WHERE hash = '%s'" % (self.tablename, hash)
self.cursor.execute(query)
rs = self.cursor.fetchall()
if not rs:
return None
file = File()
for row in rs:
file.id = row[0]
file.hash = row[1]
file.size = row[2]
file.partialSize = row[3]
file.bestName = row[4]
return file