views:

510

answers:

2

When multiple directories need to be concatenated, as in an executable search path, there is an os-dependent separator character. For Windows it's ';', for Linux it's ':'. Is there a way in Python to get which character to split on?

In the discussions to this question http://stackoverflow.com/questions/1489599/how-do-i-find-out-my-python-path-using-python , it is suggested that os.sep will do it. That answer is wrong, since it is the separator for components of a directory or filename and equates to '\\' or '/'.

+11  A: 

os.pathsep

SilentGhost
Thanks. Don't know how I missed it.
Mark Ransom
+5  A: 

It is os.pathsep

Dave Costa