I am copying files from one folder into another. The files contain dashes '-' and spaces ' ' . For example, **test-file 123.dwg**
I need to replace those hyphens and spaces with underscores so it would look like this **test\_file\_123.dwg**

I've tried this and it replaces the hyphen fine but no the space. If I comment out the one of them, the other works.

```
file = string.replace(NAME,"-", "_")  
file = string.replace(NAME," ", "_")

```

I have also tried this:

```
test = (' ', '-')  
file = string.replace(NAME, test, "_")  

```

but no luck.
I am using Python 2.7.  

All tips welcome.