[英]Reading from file to add to list
I need to get from list(file) who is coming to party and who is not.我需要从列表(文件)中找出谁要参加聚会,谁不参加。
File looks like this:文件看起来像这样:
(+) John
(?) Jake
(+) Billie
How to read that person with + is coming?怎么看那个带+的人来了?
file = open("your_file", "r")
c = []
for line in file:
if line[1] == '+':
c.append(line[4:].strip())
print(c)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.