Skip to main content
 首页 » 编程设计

python之如何从python中的绑定(bind)方法中提取值

2025年05月04日10shihaiming

<分区>

我有以下代码:

model =  MyModel() 
field = model._meta.get_field_by_name('my_field')[0] 
my_type = field.get_internal_type 
print str(my_type) 

这个输出:

<bound method URLField.get_internal_type of <django.db.models.fields.URLField: my_field>> 

如何从 ubound 方法输出中提取 URLField 类型?