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
将readlines()作为list操作一次之后 为什么会自动清空
zenomac
·
Aug 21, 2012
· 3866 views
This topic created in 5195 days ago, the information mentioned may be changed or developed.
比如
open_file.readlines().index('thestring')或者var=open_file.readlines()
然后open_file.readlines()返回的都是空列表
不太理解.
readlines
Open
file
2 replies
•
1970-01-01 08:00:00 +08:00
ratazzi
PRO
Aug 21, 2012
1
1
毕竟是文件读取操作,读取之后指针会移动的
0bit
Aug 21, 2012
2
楼上正解
想回到文件头部重新开始读取的话,用open_file.seek(0)
About
·
Help
·
Advertise
·
Blog
·
API
·
FAQ
·
Privacy
·
Solana
·
4528 Online
Highest 6679
·
Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 34ms ·
UTC 06:39
·
PVG 14:39
·
LAX 22:39
·
JFK 01:39
♥ Do have faith in what you're doing.
❯