File size: 736 Bytes
3d4f9a9 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Remove the start and end quotes from all the files in a folder."""
import argparse
import glob
import os
def remove_quotes(dir_path):
"""Remove the start and end quotes from all the files in a folder."""
for file in glob.glob(dir_path + "/*.json"):
with open(file, "r") as f:
data = f.read()
data = data[1:-1]
with open(file, "w") as f:
f.write(data)
def main():
"""Main function."""
parser = argparse.ArgumentParser()
parser.add_argument("--dir_path", type=str, default=".", help="Directory path")
args = parser.parse_args()
remove_quotes(args.dir_path)
if __name__ == "__main__":
main()
|