如何确定Python中设置变量的大小?

问题描述 投票:1回答:1

我有如下代码,其中在set(cur)中捕获了表数据。有什么办法可以在linux / unix中找到此变量占用的空间吗? (内存或缓冲区空间)

cur.execute("select A , B , C from DeptTable")
dept_entries = set(cur)

cur.execute("select A , B , C from EmployeeTable where EmplName in ('A','B')") 
for empl in cur:
  if empl in dept_entries:
    print(empl, 'Yes')
  else:
    print(empl, 'No')
python linux set cx-oracle
1个回答
1
投票

我建议使用sys.getsizeof

sys.getsizeof
© www.soinside.com 2019 - 2024. All rights reserved.