【发布时间】:2015-05-19 23:03:01
【问题描述】:
为清晰起见进行了编辑。
我知道我们有文件 IO 来访问文件元素并对其进行操作等。我的问题是我很好奇。
假设我们有几个不同的文件,在每个文件中我们可以假设只有一个list 包含此list 中的一些数据。
import os
def make_bars(self):
for files in os.listdir(os.path.dirname(os.path.abspath(__file__))):
if files.endswith('.txt'): # or some other file like .py
a_list = open(files, "r").read()
【问题讨论】:
标签: python arrays file python-3.x file-io