Q: How to get the current directory in python? I'm trying to get the current directory using the OS module, like that:
directory=os.getcwd()

However, when I do this, the directory comes with \, like 'C:\Users\...', and I need to use directory with \\ or /.
Is that anyway to get the directory with \\ or /?

A: You can just replace the \ with /. Note that the former must be escaped with another \, like below:
import os
directory = os.getcwd().replace('\\', '/')

