python case用法_Python fnmatch.fnmatchcase方法代碼示例

本文整理匯總了Python中fnmatch.fnmatchcase方法的典型用法代碼示例。如果您正苦於以下問題:Python fnmatch.fnmatchcase方法的具體用法?Python fnmatch.fnmatchcase怎麽用?Python fnmatch.fnmatchcase使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在模塊fnmatch的用法示例。

在下文中一共展示了fnmatch.fnmatchcase方法的27個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Python代碼示例。

示例1: find_std

​點讚 6

# 需要導入模塊: import fnmatch [as 別名]

# 或者: from fnmatch import fnmatchcase [as 別名]

def find_std(desc):

"""Search the standard (non-generalized) triggers. A list of

matches is returned. All terms must match. Wildcards are allowed.

Example:

find_std("CEIL UP S?") should return:

['CEIL S1 UP SLOW HNC', 'CEIL SR UP SLOW HNC']"""

terms = desc.split()

matches = []

for dsc in num2desc.values():

d = dsc.split()

matchedterms = 0

for term in terms:

for key in d:

if fnmatchcase(key, term):

matchedterms += 1

if matchedterms == len(terms):

matches.append(dsc)

return matches

開發者ID:TheVGLC,項目名稱:TheVGLC,代碼行數:22,

示例2: _matches_path

​點讚 6

# 需要導入模塊: import fnmatch [as 別名]

# 或者: from fnmatch import fnmatchcase [as 別名]

def _matches_path(self, path: str) -> bool:

"""Match the URL's path.

Deviations from Chromium:

- Chromium only matches with "javascript:" (pathless); but

we also match *://*/* and friends.

"""

if self._path is None:

return True

# Match 'google.com' with 'google.com/'

if path + '/*' == self._path:

return True

# FIXME Chromium seems to have a more optimized glob matching which

# doesn't rely on regexes. Do we need that too?

return fnmatch.fnmatchcase(path, self._path)

開發者ID:qutebrowser,項目名稱:qutebrowser,代碼行數:19,

示例3: SelectParentAndDesiredChilds

​點讚 6

# 需要導入模塊: import fnmatch [as 別名]

# 或者: from fnmatch import fnmatchcase [as 別名]

def SelectParentAndDesiredChilds(obj):

#Selects only all child objects that must be exported with parent object

selectedObjs = []

bpy.ops.object.select_all(action='DESELECT')

for selectObj in GetExportDesiredChilds(obj):

if selectObj.name in bpy.context.view_layer.objects:

if GetAssetType(obj) == "SkeletalMesh":

#With skeletal mesh the socket must be not exported, ue4 read it like a bone

if not fnmatch.fnmatchcase(selectObj.name, "SOCKET*"):

selectObj.select_set(True)

selectedObjs.append(selectObj)

else:

selectObj.select_set(True)

selectedObjs.append(selectObj)

obj.select_set(True)

if obj.ExportAsProxy == True:

if obj.ExportProxyChild is not None:

obj.ExportProxyChild.select_set(True)

selectedObjs.append(obj)

bpy.context.view_layer.objects.active = obj

return selectedObjs

開發者ID:xavier150,項目名稱:Blender-For-UnrealEngine-Addons,代碼行數:25,

示例4: UpdateNameHierarchy

​點讚 6

# 需要導入模塊: import fnmatch [as 別名]

# 或者: from fnmatch import fnmatchcase [as 別名]

def UpdateNameHierarchy(list =None):

#Updates hierarchy names

if list is not None:

objs = list

else:

objs = GetAllCollisionAndSocketsObj()

for obj in objs:

if fnmatch.fnmatchcase(obj.name, "UBX*"):

UpdateUe4Name("Box", [obj])

if fnmatch.fnmatchcase(obj.name, "UCP*"):

UpdateUe4Name("Capsule", [obj])

if fnmatch.fnmatchcase(obj.name, "USP*"):

UpdateUe4Name("Sphere", [obj])

if fnmatch.fnmatchcase(obj.name, "UCX*"):

UpdateUe4Name("Convex", [obj])

if fnmatch.fnmatchcase(obj.name, "SOCKET*"):

UpdateUe4Name("Socket", [obj])

開發者ID:xavier150,項目名稱:Blender-For-UnrealEngine-Addons,代碼行數:21,

示例5: _find

​點讚 6

# 需要導入模塊: import fnmatch [as 別名]

# 或者: from fnmatch import fnmatchcase [as 別名]

def _find(cls, pattern, manager, name, version):

name = '*' if name is None else name

installed = glob(

os.path.join(

manager.config.mods_directory,

pattern

)

)

for path in installed:

try:

mod = cls(manager, path)

except Exception as ex:

print("Warning: invalid mod %s: %s" % (path, ex))

continue

if not fnmatchcase(mod.name, name):

continue

if version is not None and version != mod.version:

continue

yield mod

開發者ID:mickael9,項目名稱:fac,代碼行數:26,

示例6: dict_match

​點讚 6

# 需要導入模塊: import fnmatch [as 別名]

# 或者: from fnmatch import fnmatchcase [as 別名]

def dict_match(d, key, default=None):

"""Like __getitem__ but works as if the keys() are all filename patterns.

Returns the value of any dict key that matches the passed

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值