Using open() inside a subroutine

imphasing alex at fortworks.com
Thu Feb 17 20:36:12 EST 2005


Whenever I try to open a file inside a subroutine, like so:

def open():
	filePath=askopenfilename()

	fileOpen = open(filePath, "r")
	fileContent = fileOpen.read()
	fileOpen.close()

it tells me that "open() takes no arguments (2 given)"
Why is that? and how can I get around that so I can open a file in a
subroutine?

Thanks,
Alex




More information about the Python-list mailing list