我想复制表格中的所有现有行:
class CountableMeta(type):
def __init__(cls, name, bases, attrs):
cls.counter = 0 # each class gets its own counter
class Countable:
__metaclass__ = CountableMeta
# in python 3 Countable would be defined like this:
#
# class Countable(metaclass=CountableMeta):
# pass
class A(Countable):
pass
print(Countable.counter) # 0
print(A.counter) # 0
Countable.counter += 1
print(Countable.counter) # 1
print(A.counter) # 0
但是我想为file_id添加一个值,因此插入的值有一个偏移量