On Sun, Sep 22, 2019 at 4:56 AM Dave Martin <dschwartz0...@gmail.com> wrote: > > On Saturday, September 21, 2019 at 2:46:15 PM UTC-4, boB Stepp wrote: > > On Sat, Sep 21, 2019 at 1:01 PM Dave Martin <dschwartz0...@gmail.com> wrote: > > > > > > On Saturday, September 21, 2019 at 1:33:12 PM UTC-4, Terry Reedy wrote: > > > > On 9/21/2019 11:53 AM, Dave Martin wrote: > > [...] > > > > > #get the combined data and load the fits files > > > > > > > > > > fits_filename="Gaia_DR2/gaiadr2_100pc.fits" > > > > > df=pd.DataFrame() > > > > > with fits.open(fits_filename) as data: > > > > > df=pd.DataFrame(data[1].data) > > > > > > > > A 'with' statement is a compound statement. It must be followed by a > > > > 'suite', which usually consists of an indented block of statements. > > > > This is line 17 from the first non-blank line you posted. > > [...] > > > > > Can you provide an example of how to use the suite feature. Thank you. > > > > Dave, you seem to have some expectation that you should be given the > > answer. That is not how help is given in this forum. You are > > expected to be doing the needed to work before being helped further. > > You have been referred to the tutorial multiple times. Please read > > it! Indentation is so fundamental to structuring Python code that it > > is clear that you need grounding in Python fundamentals. Otherwise > > you are essentially Easter-egging through a code sample that you have > > no true understanding of. > > > > If you must continue to Easter-egg Python instead of reading the > > tutorial (or something equivalent) then check the section of the > > tutorial on files. You will find examples of the use of "with" there. > > > You seem to have the expectation that you know more about coding than me and > that you can insult me without me retaliating. If I were you, I would leave > this forum and never respond to another person question again, if you think > that you can rudely ransack your way through what is supposed to be a helpful > tool. >
When you ask for help on a public forum, it's usually best to start by reading the tutorials yourself. http://www.catb.org/~esr/faqs/smart-questions.html boB is absolutely correct here: you need to learn the basics before further questions will be truly productive. We are not here to read aloud from the tutorial to you. Once you have a basic understanding of Python's structure, you will be far better able to ask questions and understand the answers. ChrisA -- https://mail.python.org/mailman/listinfo/python-list