src/figures/cantilever-data/avg_data.py: Vs.sort() -> sorted()
authorW. Trevor King <wking@tremily.us>
Wed, 17 Apr 2013 21:54:42 +0000 (17:54 -0400)
committerW. Trevor King <wking@tremily.us>
Wed, 17 Apr 2013 21:56:33 +0000 (17:56 -0400)
Avoid:

  cd .. && python avg_data.py
  Traceback (most recent call last):
    File "avg_data.py", line 78, in <module>
      write_average_file(FofV, avgK)
    File "avg_data.py", line 55, in write_average_file
      Vs.sort()
  AttributeError: 'dict_keys' object has no attribute 'sort'

src/figures/cantilever-data/avg_data.py

index e10c4ecdc25ad733d5b0f6baab429e8e35d0ce76..e72984dfe99981e1fc6f32d1a73b4c79f51455b9 100755 (executable)
@@ -51,8 +51,7 @@ def write_k_file(Ks, kfile=KFILE):
     return (avgK, stdK, numK)
 
 def write_average_file(FofV, avgK, avgfile=AVGFILE):
-    Vs = FofV.keys()
-    Vs.sort()
+    Vs = sorted(FofV.keys())
     af = open(AVGFILE, 'w')
     af.write('{}{}\n'.format(
             '#', '\t'.join(