lower() Return value lower()method returns the lowercase string from the given string. It converts all uppercase characters to lowercase. If no uppercase characters exist, it returns the original string. Example 1: Convert a string to lowercase # example stringstring ="THIS SHOULD BE LOWERCASE!
boolean equalsIgnoreCase(String anotherString) :与equals方法类似,忽略大小写 String concat(String str) :将指定字符串连接到此字符串的结尾。 等价于用“+” int compareTo(String anotherString) :比较两个字符串的大小 String substring(int beginIndex) :返回一个新的字符串,它是此字符串...
Return a copy of the string converted to lowercase.返回转换为小写的字符串副本。 将字符串中的所有字符转换成小写字母 ''' print('AbCdddEfgjKH'.lower()) 10.lstrip()方法: ''' lstrip() 方法: Return a copy of the string with leading whitespace removed. 返回一个删除前导(左侧)空白字符的副本。
string.ascii_lowercase string.ascii_uppercase string.digits string.hexdigits string.octdigits string.punctuation string.printable string.whitespace 2. 自定义字符串格式 2.1 class string.Formatter 3. 格式字符串语法 field_name conversion format_spec 3.1 格式规范Mini-Language 3.1.1 定义 3.1.2 各选项的含...
import string”,导入 string 模块。4 输入:“x = string.ascii_lowercase”,点击Enter键。5 然后输入:“print(x)”,打印出 string.ascii_lowercase 属性。6 在编辑区域点击鼠标右键,在弹出菜单中选择“运行”选项。7 在运行结果窗口中查看运行结果,可以看到已经成功地打印了string模块的ascii_lowercase属性。
string.upper(), string.lower() and string.title() Methods are inbuilt methods inPython, these are used to format string in a particular format like uppercases, lowercase or little case format. string.upper(),string.lower()和string.title()方法是Python中的内置方法,用于将字符串格式化为特殊格式...
Return a copy of the string S converted to lowercase. """ return "" 用法:返回字符串的副本,其中所有大写字母都转换为小写字母。 def swapcase(self): # real signature unknown; restored from __doc__ """ S.swapcase() -> str Return a copy of S with uppercase characters converted to lowercas...
An empty string is not alphanumeric. section Methods Python code: `upper_string = empty_string.upper()` An empty string converted to uppercase remains empty. Python code: `lower_string = empty_string.lower()` An empty string converted to lowercase remains empty. ...
""" Return a copy of the string converted to lowercase. 返回转换为小写的字符串副本。""" pass def lstrip(self, *args, **kwargs): # real signature unknown """ Return a copy of the string with leading whitespace removed. If chars is given and not None, remove characters in chars instea...
八、string模块常用字符串常量 # 使用常量需要import >>> import string as str # 生成所有小写字母 >>> str.ascii_lowercase 'abcdefghijklmnopqrstuvwxyz' # 生成所有大写字母 >>> str.ascii_uppercase 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' # 小写字母和大写字母 ...