Please check the link above, I wrote this small script in python. It backup files from one directory to the other depends upon the user input. I want to know what are the limitations of this script and all the improvements that can be done to it. So that I can learn from my mistakes, I am total beginner to programming and python. Thanks
-
1You are a total beginner and you wrote that code? Kudos. You can start improving it by naming some variables in a more readable manner. (can somebody help me improve the previous sentence?)dheerosaur– dheerosaur2010-12-24 10:02:06 +00:00Commented Dec 24, 2010 at 10:02
-
Actually I started using python last week. I started with A Byte of python tutotial By Swaroop CHhsinxh– hsinxh2010-12-24 10:05:16 +00:00Commented Dec 24, 2010 at 10:05
Add a comment
|
2 Answers
Don't use raw_input, use command-line parameters.
To do this use the optparse module (or argparse for Python 2.7+). Also the use of os.system is not recommented, see Replacing Older Functions with the subprocess Module for a replacement.
3 Comments
hsinxh
Thanks for the suggestion, I will rewrite the script using this module
Antoine Pelisse
This is a very nice suggestion, you code would probably be just a few line if you use it correctly. Functions are being very long (if not too long) here because of all the parsing.
hsinxh
Yes, the functions are unnecessarily long. I will definitely use these suggestion.