You can use the functions provided by [os.path](http://docs.python.org/3.3/library/os.path.html) for handling pathnames independendly from a platform.

    import bpy
    import os
    
    filepath = bpy.data.filepath
    directory = os.path.dirname(filepath)
    print(directory)