从我从谷歌的理解和上述两个功能的链接:lower()与casefold()将转换为小写的字符串,但casefold()甚至会转换为不区分大小写的字母,如ß用德语ss.
关于希腊字母的所有内容,但我的问题一般:
第2部分:
firstString = "der Fluß"
secondString = "der Fluss"
# ß is equivalent to ss
if firstString.casefold() == secondString.casefold():
print('The strings are equal.')
else:
print('The strings are not equal.')
Run Code Online (Sandbox Code Playgroud)
在上面的例子中,我应该使用:
lower() # the result is not equal which make sense to me
要么:
casefold() # which ß is ss and result is the
# strings are equal. (since I am a beginner that still …Run Code Online (Sandbox Code Playgroud)