Suggest a feature
×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Python
Posted by: psichic
Added: Dec 4, 2020 5:48 PM
Views: 6
Tags: no tags
  1. # ? Print the list of click commands
  2. f=file('E:/Shiva/bin/click.cmd')
  3. flines=f.readlines()
  4. f.close()
  5. tagslist=[]
  6. for s in flines:
  7.     if s[0]==':' and s[1:-2]<>'end':
  8.         if s[1]==":": #Is a comment
  9.             pass
  10.         else:
  11.             tag = s[1:].strip()
  12.             tagslist.append(tag)
  13.        
  14.  
  15. l=len(tagslist)
  16. tagslist_sorted=sorted(tagslist)
  17.  
  18. print "Listing",l,"available click suffixes\n"
  19.  
  20. #print tags one by one till the last tag is read.
  21. for tag in tagslist_sorted:
  22.     if tag <> tagslist_sorted[-1]:
  23.         print tag+',',
  24.     else:
  25.         print tag+'.'
  26. #EOF
  27.