comparison python/find_str_format.py @ 727:03b66f90916f

works
author Jeff Hammel <k0scist@gmail.com>
date Tue, 02 Dec 2014 13:59:37 -0800
parents 541560ed190f
children
comparison
equal deleted inserted replaced
726:541560ed190f 727:03b66f90916f
16 retval = set() 16 retval = set()
17 while True: 17 while True:
18 try: 18 try:
19 string.format(**{i:'' for i in retval}) 19 string.format(**{i:'' for i in retval})
20 return retval 20 return retval
21 except KeyError: 21 except KeyError as e:
22 import pdb; pdb.set_trace() 22 retval.add(e.message)
23
23 24
24 def main(args=sys.argv[1:]): 25 def main(args=sys.argv[1:]):
25 26
26 # parse command line
27 string = ' '.join(args) 27 string = ' '.join(args)
28 keys = find_keys(string)
29 print ('\n'.join(sorted(keys)))
28 30
29 if __name__ == '__main__': 31 if __name__ == '__main__':
30 main() 32 main()