Unzipping .nii.gz in python

I am using the nibabel package to load an image with 7 parcellations in it. It is a .nii.gz file and when I try to load it with nibable.load('image_file') I get the following error:

File "<ipython-input-8-ef77bd97a272>", line 1
^
SyntaxError: invalid syntax


How can I load this file in nibabel and view it?

• Is this Q in any way related to Psych&Neurosci? – AliceD Nov 7 at 23:00
• It's concerning a tool used for fMRI analysis so yeah It is obviously relevant. – Angus Campbell Nov 8 at 5:50
• Why do you have nib.load(r'string')? When you get a syntax error, check your syntax. Use an editor with syntax highlighting. – Bryan Krause Nov 8 at 5:59
• On windows OS the backslash will be treated as escape characters so the r is necessary for the string to be treated as a raw sting. See here:stackoverflow.com/questions/42654934/… – Angus Campbell Nov 8 at 8:32
• Also my question was answered on stack overflow, the variable name can't start with a number. I'm using spyder as my editor, it is a perfectly respectable datascience ODE. – Angus Campbell Nov 8 at 8:33