本文整理匯總了Python中strop.uppercase方法的典型用法代碼示例。如果您正苦於以下問題:Python strop.uppercase方法的具體用法?Python strop.uppercase怎麽用?Python strop.uppercase使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類strop
的用法示例。
在下文中一共展示了strop.uppercase方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: upper
# 需要導入模塊: import strop [as 別名]
# 或者: from strop import uppercase [as 別名]
def upper(s):
"""upper(s) -> string
Return a copy of the string s converted to uppercase.
"""
return s.upper()
# Swap lower case letters and UPPER CASE
示例2: replace
# 需要導入模塊: import strop [as 別名]
# 或者: from strop import uppercase [as 別名]
def replace(s, old, new, maxsplit=-1):
"""replace (str, old, new[, maxsplit]) -> string
Return a copy of string str with all occurrences of substring
old replaced by new. If the optional argument maxsplit is
given, only the first maxsplit occurrences are replaced.
"""
return s.replace(old, new, maxsplit)
# Try importing optional built-in module "strop" -- if it exists,
# it redefines some string operations that are 100-1000 times faster.
# It also defines values for whitespace, lowercase and uppercase
# that match <ctype.h>'s definitions.
示例3: replace
# 需要導入模塊: import strop [as 別名]
# 或者: from strop import uppercase [as 別名]
def replace(s, old, new, maxreplace=-1):
"""replace (str, old, new[, maxreplace]) -> string
Return a copy of string str with all occurrences of substring
old replaced by new. If the optional argument maxreplace is
given, only the first maxreplace occurrences are replaced.
"""
return s.replace(old, new, maxreplace)
# Try importing optional built-in module "strop" -- if it exists,
# it redefines some string operations that are 100-1000 times faster.
# It also defines values for whitespace, lowercase and uppercase
# that match <ctype.h>'s definitions.
示例4: test_data_attributes
# 需要導入模塊: import strop [as 別名]
# 或者: from strop import uppercase [as 別名]
def test_data_attributes(self):
strop.lowercase
strop.uppercase
strop.whitespace