Google colab "glob.glob" Why can't it find my 1456 files?

Viewed 1227

Why can't it find my 1456 files?

import pandas as pd  
import numpy as np
import sys
# uncommen the next row to install altair
# !{sys.executable} -m pip install altair vega_datasets
import altair as alt
import os 
import copy
import glob
import matplotlib.pyplot as plt
from google.colab import drive
drive.mount('/content/drive')
path_files = r"/content/drive/MyDrive/BigData"
# All files ending with .txt
files = glob.glob("{}\*.txt".format(path_files))
print("Nombre de fichiers: {}".format(len(files)))

results Number of files: 0

it must found 1456 files

1 Answers

the solution is:

All files ending with .txt

files = glob.glob(f"/content/gdrive/...../*.txt")
print("Nombre de fichiers: {}".format(len(files)))
Related