Add __len__ method

This commit is contained in:
Guido van Rossum 1997-01-11 19:21:33 +00:00
parent afe3ebfa5c
commit 88b85d4f63
1 changed files with 4 additions and 0 deletions

View File

@ -890,6 +890,10 @@ class FieldStorage:
if item.name == key: return 1
return 0
def __len__(self):
"""Dictionary style len(x) support."""
return len(self.keys())
def read_urlencoded(self):
"""Internal: read data in query string format."""
qs = self.fp.read(self.length)