Advertisement
lswest

TO DO.py

Oct 2nd, 2011
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.88 KB | None | 0 0
  1. #!/usr/bin/env python
  2. import os
  3. import stat
  4. import codecs
  5. import re
  6.  
  7. home=os.path.expanduser("~")
  8.  
  9. for root, dirs, files in os.walk(os.path.join(home,"Reminders")):
  10.     for infile in files:
  11.         if infile.endswith("~")!=True :
  12.             if os.stat(os.path.abspath(os.path.join(root,infile))).st_size:
  13.                 fh=codecs.open(os.path.abspath(os.path.join(root,infile)),encoding='utf-8')
  14.                 if infile[:-4].upper() == infile[:-4]:
  15.                     print(infile[:-4].upper()+":")
  16.                 else:
  17.                     if infile[:-4] == "CDs" or re.search('[0-9]th',infile[:-4]) != "None":
  18.                         print(infile[:-4]+":")
  19.                     else:
  20.                         print(infile[:-4].title()+":")
  21.                 for line in fh:
  22.                     print("- "+line, end='')
  23.                 fh.close()
  24.                 print()
  25.  
  26.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement