I was wondering how i could parse the contents of a file into an array.
the file would look something like this:
gif:image/gif
html:text/html
jpg:image/jpeg
....
As you can see, it contains the mime type and the file extension
seperated by commas, 1 per line. I was wondering if it was possible to
create and array like this:
(Pseudocode)
mimetypearray[gif] = "image/gif"
mimetypearray[html] = "text/html"
mimetypearray[jpg] = "image/jpeg"
....
I come from a PHP backround where I know this is possible, but I am new
at Python. Please disregard this if it is a stupid question.
the file would look something like this:
gif:image/gif
html:text/html
jpg:image/jpeg
....
As you can see, it contains the mime type and the file extension
seperated by commas, 1 per line. I was wondering if it was possible to
create and array like this:
(Pseudocode)
mimetypearray[gif] = "image/gif"
mimetypearray[html] = "text/html"
mimetypearray[jpg] = "image/jpeg"
....
I come from a PHP backround where I know this is possible, but I am new
at Python. Please disregard this if it is a stupid question.
Comment