Code for Python to Write/Read and Using data from file ; any suggestions can you make me to understand what we can do more? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Code for Python to Write/Read and Using data from file ; any suggestions can you make me to understand what we can do more?

I just learned Python and this functional paradigm changed my way of thinking of programming. And I tried to make this simple but easy to understand file based code ; I hope you enjoy it https://code.sololearn.com/cbM891WJbXEC/?ref=app

25th May 2017, 1:40 PM
Melih Melik Sonmez
Melih Melik Sonmez - avatar
2 Answers
+ 2
Good code. Sugestion: If you would like, you could use the 'with' context manager instead of try/finally block. It is simpler to use: with open(filename, mode) as f: f.write(string_to_be_writen) ... I use 'f' here but you can use any variable name. The file is closed automatically when the block ends.
25th May 2017, 2:02 PM
Ulisses Cruz
Ulisses Cruz - avatar
0
nice start. One suggestion: never try to parse CSV code yourself. Or embrace the spaghetti code. Just saying that for your own sake
26th May 2017, 2:06 AM
Amaras A
Amaras A - avatar