Finding size of Variable
Rustom Mody
rustompmody at gmail.com
Wed Feb 5 00:45:09 EST 2014
On Wednesday, February 5, 2014 11:05:05 AM UTC+5:30, Ayushi Dalmia wrote:
> This also doesn't gives the true size. I did the following:
> import sys
> data=[]
> f=open('stopWords.txt','r')
> for line in f:
> line=line.split()
> data.extend(line)
> print sys.getsizeof(data)
> where stopWords.txt is a file of size 4KB
Try getsizeof("".join(data))
General advice:
- You have been recommended (by Chris??) that you should use a database
- You say you cant use a database (for whatever reason)
Now the fact is you NEED database (functionality)
How to escape this catch-22 situation?
In computer science its called somewhat sardonically "Greenspun's 10th rule"
And the best way out is to
1 isolate those aspects of database functionality you need
2 temporarily forget about your original problem and implement the dbms
(subset of) DBMS functionality you need
3 Use 2 above to implement 1
More information about the Python-list
mailing list