Skip to content

Commit d7eb7d1

Browse files
author
Kendrick Ledet
committed
adding py3k script to fix tag files
1 parent 43285f0 commit d7eb7d1

2 files changed

Lines changed: 27 additions & 1 deletion

File tree

String_to_int/tags

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
Convertion
1+
Conversion

fix_tag_files.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import pathlib
2+
3+
def fix_tag_file(tagfile):
4+
print("Fixing", tagfile)
5+
with tagfile.open() as f:
6+
by_comma = list(map(lambda tag: tag.strip('\n')+'\n', f.read().split(',')))
7+
if len(by_comma) == 1:
8+
return
9+
10+
print (by_comma)
11+
f.writelines(by_comma)
12+
13+
14+
15+
16+
cdir = pathlib.Path('.')
17+
subdirs = [subdir for subdir in cdir.iterdir() if subdir.is_dir()]
18+
19+
print (subdirs)
20+
21+
for subdir in subdirs:
22+
tagfile = subdir / 'tags'
23+
if tagfile.exists():
24+
fix_tag_file(tagfile)
25+
26+

0 commit comments

Comments
 (0)