nilamo, thank you for your suggestion.
wavic, I got your point and will keep it in mind in future (sorry).
zivoni, I appreciate your comment.
wavic, I got your point and will keep it in mind in future (sorry).
zivoni, I appreciate your comment.
for dirpath, dirname, files in os.walk('/Users/mymac/Documents/Jupyter/Twitter/00/05/'): for filename in files: if filename.endswith('.json.bz2'): filepath = os.path.join(dirpath, filename) newfilepath = os.path.join(dirpath, filename[:-4]) print(filepath) print(newfilepath) with open(newfilepath, 'wb') as new_file, bz2.BZ2File(filepath, 'rb') as file: for data in iter(lambda : file.read(100 * 1024), b''): new_file.write(data)Thank you, guys :)