I Want to convert com to newcom
com = R.E.M. - Losing My Religion.mp3
newcom = R.E.M.\ -\ Losing\ My\ Religion.mp3
newcom = com.replace(' ', '\\ ')
You need to replace a space with an (escaped) backslash and another space - that's exactly what Python's replace method is for.
Alternatively, an ubuntu terminal is fine with directories in quotes, e.g.
cd "hello world"
is just as valid as your solution, which would give
cd hello\ world
And perhaps cleaner to the user, and more accepting of other characters that might need to be escaped.