用python 比较两个strings 是否相同,忽略大小写程序怎么写

2025-05-07 08:02:06
推荐回答(1个)
回答1:

要忽略大小写,可以先使用将两个字符统一转化为大写,然后再作比较,如下: s1="Hello"s2="hello"if s1.upper()==s2.upper(): print "两个字符串相同"#输出结果为:两个字符串相同