我有一个像这样的列表,其中长度为3或更大的组中有一些重复的条目:
[1,2,1,1,1,2,3,4,1,2,5,1,1,1,1,1,1,2,4,1,3,5,2,2,6,4,1,6,1,1,3,5,2,2,6,4,1,6,2,7,2,6,1,1]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
我想从某个特定点提取值,该点从该点开始连续3次没有连续出现任何数字。
有条件的提取物与上述相同。并且列表将始终以1,3或4开头
我正在寻找比使用循环更快的解决方案。
期望的输出是列表:
[1,2,4,1,3,5,2,2,6,4,1,6,1,1,3,5,2,2,6,4,1,6,2,7,2,6,1,1]
答案 0 :(得分:3)
可以使用http://localhost:8080/second
查找三个连续值的最后一个索引。
Traceback (most recent call last):
File "/anaconda3/envs/ki/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/anaconda3/envs/ki/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/anaconda3/envs/ki/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/anaconda3/envs/ki/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/anaconda3/envs/ki/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by /anaconda3/envs/ki/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/anaconda3/envs/ki/lib/python3.6/site-packages/tensorflow/__init__.py", line 28, in <module>
from tensorflow.python import pywrap_tensorflow # pylint: disable=unused-import
File "/anaconda3/envs/ki/lib/python3.6/site-packages/tensorflow/python/__init__.py", line 49, in <module>
from tensorflow.python import pywrap_tensorflow
File "/anaconda3/envs/ki/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 74, in <module>
raise ImportError(msg)
ImportError: Traceback (most recent call last):
File "/anaconda3/envs/ki/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
from tensorflow.python.pywrap_tensorflow_internal import *
File "/anaconda3/envs/ki/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
_pywrap_tensorflow_internal = swig_import_helper()
File "/anaconda3/envs/ki/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
_mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
File "/anaconda3/envs/ki/lib/python3.6/imp.py", line 243, in load_module
return load_dynamic(name, filename, file)
File "/anaconda3/envs/ki/lib/python3.6/imp.py", line 343, in load_dynamic
return _load(spec)
ImportError: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.28' not found (required by /anaconda3/envs/ki/lib/python3.6/site-packages/tensorflow/python/_pywrap_tensorflow_internal.so)
Failed to load the native TensorFlow runtime.
See https://www.tensorflow.org/install/errors
for some common reasons and solutions. Include the entire stack trace
above this error message when asking for help.