Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/340.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/string/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python字符串长度两个值_Python_String_String Length - Fatal编程技术网

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)
,这始终是真的。