Changes between Version 3 and Version 4 of PythonScriptForParsingSettings
- Timestamp:
- Dec 23, 2009, 1:31:11 AM (15 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
PythonScriptForParsingSettings
v3 v4 45 45 # ini.get('KEY', defaultvalue) if a key has been delete, it'll also can be returned 46 46 # ini.keys() omit the key deleted 47 # ini.has_key('KEY')omit the key deleted47 # 'KEY' in ini omit the key deleted 48 48 # ini.get_obj('KEY') can also get a delete obj 49 49 # ini.save(filename or fileobj) saving the result to file … … 159 159 x, y = b.span(2) 160 160 if deleteflag: 161 x = x +1161 x += 1 162 162 value = value.strip() 163 163 obj = Node(self, key, value, lines, span=(0, x+len(value)), delete=deleteflag) … … 166 166 if value == '(': 167 167 s = ['('] 168 while 1:168 while True: 169 169 line = f.next().rstrip() 170 170 if line.startswith('#') and deleteflag: … … 272 272 return [obj.value for obj in self.items.values()] 273 273 274 def has_key(self, name):275 return self._items.has_key(name)274 def __contains__(self, name): 275 return name in self._items 276 276 277 277 def save(self, filename=None, encoding='utf-8'):