File size: 10,797 Bytes
ea62a47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
f12337d
 
 
 
 
 
 
 
 
 
 
ea62a47
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\03c67b009e6581e076615a4f9b71367b.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\0476f074c637d11afe8990707b1bd58b.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\0848e91ca8d354126a3f5ca1f27b823b.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\0a7c83cc86a819d9d7dc086f6b0f187c.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\10b4bd37a5593d5740365acd5e24c37a.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\121009814ce67aaffba55075a34feb06.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\1951c9ae19851b1032ecb069aeff0c6c.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\1aad2bcd835b573b55cb1ccd98b92d43.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\1bd498638f0c7a588d4da253de471258.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\1cc8ea9dd0f1f068014314fd15ed9ad9.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\1d411b14dd22f24cb54a04fc07a85996.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\1de149ed30600acf277e32a9c48e3879.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\1e5dade6a65aeb3537e9eb5d49c2dd00.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\1f2ddd50c22a314c3447f19206855410.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\24822d9ddaae7260c59553290400a79e.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\277361bdfaafac051885ee07c5416b63.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\289a0e858026ab8585df8e34c1aa6c35.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\29c13b2ea7279fbd66eea6a3bcee8c13.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\3245e9826b5f3fda0e020391f4be5463.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\3c2e90d1fe89319da13c4497124bb8aa.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\3fa84aa5dd2a408c1896ce701998787c.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\4d10005d667513f3b984c182c0a409d7.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\5aefee29406f5b5db89a3df2ce343e0b.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\5dd1d683386dafd3305f872c72354370.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\5e46e26270e33a062282af82c8d31150.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\5e60084e9ad3ca9f704f7b8963c9fa97.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\5fd70c9088ebece61d9018b078f54db3.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\605bb58fb3f5c343d6db9c10cffbd577.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\6779aa12607f3a6b2bffa9e5ccb31bcf.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\67ba2ed39f13b60b3e73f1af2f96f966.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\67fb1251907898c6fdc08084c56d6f9e.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\6d8f57a3f0840b9fa5ff41cdae43ab01.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\6e073e3085e29e59f28e6984ac7663cc.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\7b939d638f70a638264b5b8eec3a6591.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\7c4c7e4f15a953c992d6435b36a815d4.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\7fd38428a8469124bf5f16055b68250b.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\847c60b16de80a7b4342111529502ed4.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\9afb78386c656d87d64f1d5635b34bf9.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\9e595a406ca31b7dc7c6be378c7448a4.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\9f7f1934ef62891808833802d78c51c9.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\a37c81dfb67551a0c0820d5a383cf7c4.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\ad7127ddca55e8d8c3958bc58a05685e.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\b006b2e9995048da2fb6e328ee6cfcd8.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\b27e0b7a5b4aa581da036792143046c4.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\b3a55669d7f945c451358defda612e08.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\b40f8b2fa0e877f8af8488953392cd30.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\bb5147e35feead82c04b03a84f07c144.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\c06c3afbd6e2ff687410eb37a3b16bcd.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\c16face7295c8333cac893ff62ba291c.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\c9c47f239426a6b5173f2c40fc678468.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\ca2edfcc56081be6c707b4c130941aaa.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\d5aa8f4d3ca3a45648b8bf2d8a3295c7.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\d9af3b50bd80b46c0436ac2b3d16d94b.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\dcc6b617c9d02b58ee7c97de5c9be7cb.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\e32fbf97383c0d49f278b6d15c46dc25.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\e6e23b1a04939a54a40c685e4b8616c8.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\e76626932ef295c86180406b7a0d7030.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\e791abb184a749ded632ec67dadaa852.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\e80dc2531447d773540fe485d9bc26a5.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\e89a1538e6332b45c11de5c76ff567f8.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\ed20a06beef0a0ae0fee6ea52eca6998.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\f33c2d22a0ea5c0e3aecbbc641b66707.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\f43c0d4787a957096e96a253c3f88f99.caption\n",
      "Removed commas from C:\\Users\\kade\\Desktop\\training_dir_staging\\1_wickerbeast\\f6d85112d49064be65f1e5a2da898ee5.caption\n"
     ]
    },
    {
     "ename": "",
     "evalue": "",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31mThe Kernel crashed while executing code in the current cell or a previous cell. \n",
      "\u001b[1;31mPlease review the code in the cell(s) to identify a possible cause of the failure. \n",
      "\u001b[1;31mClick <a href='https://aka.ms/vscodeJupyterKernelCrash'>here</a> for more info. \n",
      "\u001b[1;31mView Jupyter <a href='command:jupyter.viewOutput'>log</a> for further details."
     ]
    }
   ],
   "source": [
    "import os\n",
    "\n",
    "def remove_commas_from_caption_files(directory):\n",
    "    for root, dirs, files in os.walk(directory):\n",
    "        for file in files:\n",
    "            if file.endswith('.caption'):\n",
    "                filepath = os.path.join(root, file)\n",
    "                try:\n",
    "                    with open(filepath, 'r') as f:\n",
    "                        lines = f.readlines()\n",
    "                    with open(filepath, 'w') as f:\n",
    "                        for line in lines:\n",
    "                            f.write(line.replace(',', ''))\n",
    "                    print(f\"Removed commas from {filepath}\")\n",
    "                except Exception as e:\n",
    "                    print(f\"Error processing file {filepath}: {e}\")\n",
    "\n",
    "if __name__ == \"__main__\":\n",
    "    directory = r'C:\\Users\\kade\\Desktop\\training_dir_staging'\n",
    "    remove_commas_from_caption_files(directory)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "base",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}