Gage Laporta
Gage Laporta

Reputation: 1

SyntaxError (Python Jupyter Notebook)

Not sure How to fix this.

SyntaxError: Missing parentheses in call to 'print'. Did you mean print(IM.dtype # prints image type)?

plt.figure(figsize=(60,30))

IM = mh.imread('TestNodose.png')  # Loads in image
print IM.dtype                    # prints image type
pylab.imshow(IM)                  # shows image
pylab.gray()                      # makes it greyscale
pylab.show()

enter image description here

Upvotes: 0

Views: 200

Answers (2)

Lwi
Lwi

Reputation: 399

in python 2 print don't need parenthesis, however you have to write them in python3.
The correct syntax is

print(IM.DTYPE)

because your jupyter notebook is using python 3

Upvotes: 0

loginmind
loginmind

Reputation: 603

This is basically syntax error. Your notebook is using Python 3, and in Python 3 print function require parenthesis. Correct syntax: print()

In python 2, we don't need the parenthesis.

Upvotes: 1

Related Questions