I don’t know why you thought it appropriate to resurrect a long-dead thread, but:
By “mysplit()” you probably mean “mystring.split()”. In case you really have a file that’s in this rather peculiar format, you should proceed in two or three steps: first strip brackets from the line, then split the line, and lastly, if necessary, strip quotes from each element in the list. And actually even before the first step you should right-strip the line ending chars from the string read from a file.
Originally Posted by ackpython
But in actual practice you probably wouldn’t encounter this kind of formatting, and if you did, you might even – cautiously! – employ Python’s own parser to do this.
mylist2 = [item.strip("'") for item in mystring.rstrip().strip('').split(', ')]
My armada: openSUSE 13.1 (home desktop, home laptop), Crunchbang Linux 11 (work laptop), Trisquel GNU/Linux 6.0.1 (mini laptop), Ubuntu 14.04 LTS (server), Android 4.2.1 (tablet), Windows 7 Ultimate (testbed)