I have a function in my script that takes two arguments and save result to file:
def listing(val, ftype):
with open(sys.argv[3], "a+") as myfile:
myfile.write(val + ftype + '\n')
return
but I want to use it when only one argument is provided. I can define argument as empty string '' like that:
listing('', '\n[*]Document files found:\n')
Is it the only way to deal with empty arguments?
def listing(ftype, val=None). How the function then deals with the value internally is up to you.sys.argv[3]in your function sucks.