Python tkFileDialog.askdirectory error
Question: i have a following code in python

    
    
    import Tkinter,tkFileDialog
    top=Tkinter.Tk()
    from tkFileDialog import askopenfilename
    dirname = tkFileDialog.askdirectory(parent=top)
    

when i print the dirname it appears as normal,and gives

    
    
    F:/Project/Dropbox/My Mtech Main Project/Programming Folder/SPIDER/Ubuntu Spyder/
    

But when i acess the dirname,otherwise, ie.. like type dirname in command
windows i got the following output,

    
    
        u"F:/Project/Dropbox/My Mtech Main Project/Programming Folder/SPIDER/Ubuntu Spyder/"
    

How can i avoid this u ,so that i can use the dirname as an input to another
operation like, read a wavefile etc. Now i got the error becuase of that u.


Answer: Well the `u` before the `path` is just to show that the string is of `unicode
type`  

you can check the `type` of `data` by using the function `type(data)` (check
for `dirname`)

    
    
    Unicode strings are expressed as instances of the unicode type
    one of Python's repertoire of built-in types
    

more information [here](http://docs.python.org/2/howto/unicode.html)  

In case you want to avoid this just change the type.  

    
    
    import Tkinter,tkFileDialog
    top=Tkinter.Tk()
    from tkFileDialog import askopenfilename
    dirname = str(tkFileDialog.askdirectory(parent=top))
    

  
hope that helps

