我在 github 中有一个文件夹,其中包含文本文件,当我尝试在 Google colab 中阅读下面的代码时,出现错误
FileNotFoundError:[Errno 2]没有这样的文件或目录:' https://github.com/Jainu-s/urldata/tree/master/al?raw=true '
loc = 'https://github.com/Jainu-s/urldata/tree/master/al?raw=true'
#uploaded = files.upload()
os.chdir(loc)
filelist = os.listdir()
#print (len((pd.concat([pd.read_csv(item, names=[item[:-4]]) for item in filelist],axis=1))))
data = []
path = loc
files = [f for f in os.listdir(path) if os.path.isfile(f)]
for f in files:
with open(f,'r') as myfile:
data.append(myfile.read())
df = pd.DataFrame(data,columns=['Data'])
print (df.shape)
Run Code Online (Sandbox Code Playgroud)