I'm currently working on some project using PyFITS. As a beginner with python 3.3, I can't figure out the two errors I get... 1st error------------------------
import pyfits;\
hdulist = pyfits.open('/Users/geo/Desktop/test/casa.fits')\
for i in range(1,26) :\
str = hdulist[0].header[i];\
print(str);\
i=i++;
File "<ipython-input-41-651183e88e23>", line 3
for i in range(1,26) :\
^
SyntaxError: invalid syntax
Seems weird since when I do the "import" and "hdulist=..." before the "for", like 3 different inputs in console instead of 1, I get no error...
2nd error----------------------- I try to handle the IndexError I get when hdulist[0].header[i]=None. In my case this is true for i=26 or more. So I use except :
try:\
hdulist[0].header[30]==None\
except:\
print("end of headers")
File "<ipython-input-28-fe19468a3999>", line 3
except:\
^
SyntaxError: invalid syntax
I don't know how to solve this, so if you have an idea and are kind enough to help, thank you! ^^ Geo