Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import os
- import stat
- import codecs
- import re
- home=os.path.expanduser("~")
- for root, dirs, files in os.walk(os.path.join(home,"Reminders")):
- for infile in files:
- if infile.endswith("~")!=True :
- if os.stat(os.path.abspath(os.path.join(root,infile))).st_size:
- fh=codecs.open(os.path.abspath(os.path.join(root,infile)),encoding='utf-8')
- if infile[:-4].upper() == infile[:-4]:
- print(infile[:-4].upper()+":")
- else:
- if infile[:-4] == "CDs" or re.search('[0-9]th',infile[:-4]) != "None":
- print(infile[:-4]+":")
- else:
- print(infile[:-4].title()+":")
- for line in fh:
- print("- "+line, end='')
- fh.close()
- print()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement