which one should I use: os.sep or os.path.sep?

I’d use os.path.sep to make it very clear that it’s the path separator… But consistency is more important, so if one is already being used, use that. Otherwise, pick one and use it all the time.

Edit: Just to make sure you’re not reinventing the wheel, though, the path module already has join, split, dirname, and basename functions… So you should rarely need to use path.sep:

>>> os.path.join("foo", "bar", "baz")
'foo/bar/baz'
>>> os.path.split(_)
('foo/bar', 'baz')

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)