Python字符串长度两个值
我有以下代码:Python字符串长度两个值,python,string,string-length,Python,String,String Length,我有以下代码: errors = the_data.loc[the_data['Column'].str.len() != 2 or 3] 基本上,我希望在列值不是2或3个字符长时标记行。当我有这样的设备时,效果很好: errors = the_data.loc[the_data['Column'].str.len() != 3] 有什么建议吗?也许正确的方法是 errors = the_data.loc[not (2 <= len(the_data['Column']) <=
errors = the_data.loc[the_data['Column'].str.len() != 2 or 3]
基本上,我希望在列值不是2或3个字符长时标记行。当我有这样的设备时,效果很好:
errors = the_data.loc[the_data['Column'].str.len() != 3]
有什么建议吗?也许正确的方法是
errors = the_data.loc[not (2 <= len(the_data['Column']) <= 3)]
errors=the_data.loc[not(2
errors = the_data.loc[not (2 <= len(the_data['Column']) <= 3)]
errors=the_data.loc[not(2)字符串没有.len()
方法,您指的是str.\uu len.\uuuuuno()
或len(str)
len()!=2或(3)
,即(len()!=2)或(true)
,始终为真。没有.len
字符串的方法,您指的是str.\uu len\uuuu()
或len(str)
len()!=2或3
是(len()!=2)或(3)
,这是(len()!=2)或(true)
,这始终是真的。