Possible Duplicate:
python obtain variable name of argument in a function
I have the following code which creates a file list.txt,currently i hard-code the filename as 'list.txt',is there a way we can create the filename dynamically based on the argument name passed to the function Eg..list is passed as argument here in this example,so file name should be list.txt,if the parameter is list2.txt,file name should be list2.txt .....
def filecreation(list):
#print "list"
with open('list.txt', 'w') as d:
d.writelines(list)
def main():
list=['206061\n', '202086\n', '206062\n']
filecreation(list)
if __name__ == '__main__':
main()