Python打开文件,存入列表

如下仅为示例

whitelist=[]
with open('/test/whitelist.txt','r') as f:
    for line in f.readlines():
        return_msg=line.strip('\n')
        whitelist.append(return_msg)

你可能感兴趣的:(python,python)