Home > other >  Introduction to python global variables?
Introduction to python global variables?

Time:09-23

Is also a not an error if the file is what figure black tip to global variable bonus picture two?

CodePudding user response:

The first is that no matter what, it is normal operation, or make a mistake, have the file open, so if the file no problem
Second, if you try to open it, then the file is empty, should be prompt is not defined

CodePudding user response:

Yeah there seems to be into a global variable is not defined
Because if you don't open the file didn't define?

CodePudding user response:

reference 1st floor weixin_45903952 response:
is the first anyway, is running, or make a mistake, have the file open, so if the file no problem
Second, if you try to open it, then the file is empty, should be a tip is not defined.

Yeah there seems to be into a global variable is not defined
Because if you don't open the file didn't define?

CodePudding user response:

reference qq_45690504 reply: 3/f
Quote: refer to 1st floor weixin_45903952 response:
is the first anyway, is running, or make a mistake, have the file open, so if the file no problem
Second, if you try to open it, then the file is empty, should be a tip is not defined.

Yeah there seems to be into a global variable is not defined
Because if you don't open the file didn't define?

Can be set by file error types in the except processing, not in the finally

CodePudding user response:

reference 4 floor weixin_45903952 response:
Quote: reference qq_45690504 reply: 3/f

Quote: refer to 1st floor weixin_45903952 response:
is the first anyway, is running, or make a mistake, have the file open, so if the file is no problem
Second, if you try to open it, then the file is empty, should be a tip is not defined.

Yeah there seems to be into a global variable is not defined
Because if you don't open the file didn't define?

Can be set by file error types in the except processing, not in the finally

But it seems to say to want to ensure finnally can't write code in any normal abnormal must perform the except

CodePudding user response:

reference 4 floor weixin_45903952 response:
Quote: reference qq_45690504 reply: 3/f

Quote: refer to 1st floor weixin_45903952 response:
is the first anyway, is running, or make a mistake, have the file open, so if the file is no problem
Second, if you try to open it, then the file is empty, should be a tip is not defined.

Yeah there seems to be into a global variable is not defined
Because if you don't open the file didn't define?

Can be set by file error types in the except processing, not in the finally

And the most magical is teacher wrote no black line no error...
Now we use the with the as replaced the useless try finally but still feel very mystery

CodePudding user response:

Estimates are that there is no error, open is a student id, you this is not

CodePudding user response:

refer to 7th floor weixin_45903952 response:
estimates are that there is no error, open to have a student id, you this is no

Oh oh mean he run have been defined before?

CodePudding user response:

 with the open (file_name, 'r', endcode=(" utf-8 ")) as f: 
Stu_read=f.r eadlines


Directly with the open aren't so sweet, a try and except fix, finnaly

CodePudding user response:

reference MuSa, 9/f, xiaoxiang reply:
 with the open (file_name, 'r', endcode=(" utf-8 ")) as f: 
Stu_read=f.r eadlines


Directly with the open aren't so sweet, a try and except fix, finnaly don't

With the open fragrance behind us is really about the
Ask this time also didn't want to know this ask what go wrong
  • Related