斯潘8
斯潘4
下面是为python 3.6更新的相同代码,@杰伦斯提尔
导入fmeobjectsimport unicodedata作为ud def rmdiacritics(char):''返回char的基字符,通过“删除”任何音调符号,如重音符号、卷发、笔画等。''desc=ud.name(char)cutoff=desc.find('with')如果切断!=-1:desc=desc[:cutoff]返回ud.lookup(desc)def removeaccents(feature):attribute_list=(名称“,“类型”,“state”)根据需要修改feature.getAllattributeNames()中的attrib:if attrib in attribute ou list:value=feature.getattribute(attrib)if value:value=str(value)new ou value='.join([rmdiacritics(char)for char in value])feature.setattribute(attrib,新值)
你好,
这里有一个使用蟒蛇的更动态的解决方案。修改“属性列表”(第16行,区分大小写)要包括要检查重音的属性的名称:
导入fmeobjectsimport unicodedata作为uddef rmdiacritics(char):''返回char的基字符,通过“删除”任何音调符号,如重音符号、卷发、笔画等。''desc=ud.name(unicode(char))cutoff=desc.find('with')if cutoff!=-1:desc=desc[:cutoff]返回ud.lookup(desc)def removeaccents(feature):attribute_list=(名称“,“类型”,“state”)根据需要修改feature.getAllattributeNames()中的attrib:if attrib-in-attribute:value=feature.getattribute(attrib)if-value:value=unicode(value)new_value='.join([rmdiacritics(char)for char-in-value])feature.setattribute(attrib,新值)pythoncaller前面的示例值:
?2019安全亚搏在线软件公司|合法的