You don't need to change the spaces in your path - as @MadPhysicist said, sometimes you don't have control over that. Instead, you can surround your path in quotes and mark it as a raw string literal:
In [42]: %run r"C:\Python code\python_practice_code.py"
You should always mark native Windows paths (using the \ path delimiter) as raw strings, as \ is used in regular strings as the beginning of an escape sequence (see the link above for their definitions). For example, \t is the escape sequence for a tab character, so if your path is, for example, C:\code\test.py, Python will interpret it as C:\code est.py, which is not what you want.
Alternatively, you can use forward slashes as path delimiters (you should get used to doing this anyway) and escape the space:
In [43]: %run C:/Python\ code/python_practice_code.py
- 103.3k
- 21
- 251
- 239