From: Mauro Scomparin Date: Wed, 12 Apr 2017 00:34:08 +0000 (+0200) Subject: Aggiunto funzione per nome file e pretty print. X-Git-Url: https://git.scompo.it/?a=commitdiff_plain;h=0ecbbae7924bc7af36e0b131c3f1826f49b534a2;p=money.git Aggiunto funzione per nome file e pretty print. --- diff --git a/money.py b/money.py index 1b08232..6a6b063 100755 --- 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.') +