Home
Sign Up
Sign In
推荐学习书目
›
Learn Python the Hard Way
Python Sites
›
PyPI
- Python Package Index
›
http://diveintopython.org/toc/index.html
›
Pocoo
值得关注的项目
›
PyPy
›
Celery
›
Jinja2
›
Read the Docs
›
gevent
›
pyenv
›
virtualenv
›
Stackless Python
›
Beautiful Soup
›
结巴中文分词
›
Green Unicorn
›
Sentry
›
Shovel
›
Pyflakes
›
pytest
Python 编程
›
pep8 Checker
Styles
›
PEP 8
›
Google Python Style Guide
›
Code Style from The Hitchhiker's Guide
V2EX
›
Python
请教类似[ 0 1 2 3 4 5]如何转化成列表
songdg
·
Jul 11, 2019
· 2575 views
This topic created in 2595 days ago, the information mentioned may be changed or developed.
请教类似[ 0 1 2 3 4 5]如何转化成列表
请教
列表
转化
类似
5 replies
•
2019-07-12 14:32:13 +08:00
1
songdg
OP
Jul 11, 2019
使用了 np.nonzero 生成的类似[ 0 1 2 3 4 5]如何转化成列表内置的列表
2
sikariba
Jul 11, 2019
返回的是 tuple,你先 indexing 一下再掉 list 构造函数就可以了吧?有什么特殊要求吗
3
Takamine
Jul 11, 2019
这个是字符串吗,字符串的话可以这样。
s1 = "[ 0 1 2 3 4 5]"
arr = [x for x in s1[::2][1:]]
4
dongxiao
Jul 11, 2019
1
@
songdg
#1 np.nonzero(range(1, 5))[0].tolist()
5
songdg
OP
Jul 12, 2019
@
dongxiao
谢谢帮助。
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Solana
·
5946 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 54ms ·
UTC 03:10
·
PVG 11:10
·
LAX 20:10
·
JFK 23:10
♥ Do have faith in what you're doing.
❯