As in question. Below is code that I use when I have to deal with cross platform paths. Is there better way to do that than this?

```
import platform

my_os = platform.system()
if my_os == "Windows":
    slash = "\\"
else:
    slash = "/"

```

Random example in code:

```
source_path = ""
for part in __file__.split("/")[:-1]:
    source_path += (part + slash)

print(source_path)

```