本文整理匯總了Python中django.contrib.gis.gdal.field.Field方法的典型用法代碼示例。如果您正苦於以下問題:Python field.Field方法的具體用法?Python field.Field怎麽用?Python field.Field使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類django.contrib.gis.gdal.field
的用法示例。
在下文中一共展示了field.Field方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __getitem__
# 需要導入模塊: from django.contrib.gis.gdal import field [as 別名]
# 或者: from django.contrib.gis.gdal.field import Field [as 別名]
def __getitem__(self, index):
"""
Gets the Field object at the specified index, which may be either
an integer or the Field's string label. Note that the Field object
is not the field's _value_ -- use the `get` method instead to
retrieve the value (e.g. an integer) instead of a Field instance.
"""
if isinstance(index, six.string_types):
i = self.index(index)
else:
if index < 0 or index > self.num_fields:
raise OGRIndexError('index out of range')
i = index
return Field(self, i)
示例2: get
# 需要導入模塊: from django.contrib.gis.gdal import field [as 別名]
# 或者: from django.contrib.gis.gdal.field import Field [as 別名]
def get(self, field):
"""
Returns the value of the field, instead of an instance of the Field
object. May take a string of the field name or a Field object as
parameters.
"""
field_name = getattr(field, 'name', field)
return self[field_name].value