Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

为何合并只读取了每条评论的第一行 #9

Open
gotogoal opened this issue Jan 23, 2019 · 1 comment
Open

为何合并只读取了每条评论的第一行 #9

gotogoal opened this issue Jan 23, 2019 · 1 comment

Comments

@gotogoal
Copy link

为何你在合并1000个评论变成一个合并文件2000_neg.txt或者2000_pos.txt的时候读取的都是每个文件的第一行呢?
def getContent(fullname):
f = codecs.open(fullname, 'r')
content = f.readline()
f.close()
return content
readline()不是只读取了一行吗

@justinmars
Copy link

使用readlines()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants