-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathfind_titles_ending_with_number.py
More file actions
43 lines (30 loc) · 1.02 KB
/
find_titles_ending_with_number.py
File metadata and controls
43 lines (30 loc) · 1.02 KB
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
# coding=utf-8
from helper_routines import creation_date
from helper_routines import modification_date
from helper_routines import access_date
from helper_routines import checkPath
from helper_routines import getNotesFileNames
from helper_routines import stripEmptyTailLines
import sys
import os
import codecs
from datetime import datetime
import math
import re
notesPath = sys.argv[1]
checkPath(notesPath)
notesFileNames = getNotesFileNames(notesPath)
for noteFileName in notesFileNames:
noteFilePath = notesPath + noteFileName
try:
#print(noteFilePath)
with codecs.open(noteFilePath, 'r', encoding='utf-8') as file:
lines = file.read().splitlines()
file.close()
tag_line = lines[1]
m = re.search(r'\d$', tag_line)
# if the string ends in digits m will be a Match object, or None otherwise.
if m is not None:
print noteFileName + " title: >" + tag_line + "<"
except Exception, e:
print("ERROR: " + str(e) )