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

图片标签错误的BUG #286

Open
zhong-xin opened this issue Feb 25, 2021 · 0 comments
Open

图片标签错误的BUG #286

zhong-xin opened this issue Feb 25, 2021 · 0 comments

Comments

@zhong-xin
Copy link

zhong-xin commented Feb 25, 2021

你好,在使用本工程的代码时发现一个图片标签错误的BUG,是因为换行符导致的图片标签错误,具体如下:
出错的代码在_own.py文件的24行
self.labels = [{c.split(' ')[0]: c.split(' ')[-1][:-1]} for c in file.readlines()]

当用户的text.txt的最后一行是空白行时,得到的图片标签是“205341_02.PNG“:” JC1839”
text.txt文件的最后两行如下
205341_02.PNG JC1839 # 这是文件的倒数第二行
这是文件的最后一行,空白行

当用户的text.txt的最后一行不是空白行时,得到的图片标签是“205341_02.PNG“:” JC183”
205341_02.PNG JC1839 # 这是文件的最后一行

正确的应该是
self.labels = [{c.split(' ')[0]: c.split(' ')[-1].strip("\n")} for c in file.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

1 participant