Aggiunto funzione per nome file e pretty print.
authorMauro Scomparin <scompo@gmail.com>
Wed, 12 Apr 2017 00:34:08 +0000 (02:34 +0200)
committerMauro Scomparin <scompo@gmail.com>
Wed, 12 Apr 2017 00:34:08 +0000 (02:34 +0200)
money.py

index 1b082324e6437119e375d4fc75bcb54b352ec056..6a6b0636b6867dbfefe0e82dc98a896cf54a97ef 100755 (executable)
--- a/money.py
+++ b/money.py
@@ -2,6 +2,7 @@
 
 from time import localtime, strftime
 from os.path import expanduser, join
+from pprint import pprint
 
 def leggi_tipo():
     t = input('tipo (+/-) [-]: ')
@@ -58,12 +59,18 @@ def scrivi_movimento(path, m):
         f.write('\n')
     return
 
+def file_output():
+    home = expanduser('~')
+    out_file_name = 'movimenti.dat'
+    out_file = join(home, 'dati', out_file_name)
+    return out_file
+
 print("money 0.0.1")
-home = expanduser('~')
-out_file_name = 'movimenti.dat'
-out_file = join(home, 'dati', out_file_name)
+out_file = file_output()
 print('file output:', out_file)
 m = leggi_movimento()
 scrivi_movimento(out_file, m)
-print('scritto:', m)
+print('scritto:')
+pprint(m)
 print('grazie.')
+