- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Manogna has Published 40 Articles
Manogna
434 Views
The problem is that thread_obj.start() returns immediately. The child thread that you started executes in its own context, in its own stack. Any exception that occurs there is in the context of the child thread. You have to communicate this information to the parent thread by passing some message.The code ... Read More
Manogna
105 Views
We can use the finally clause to clean up whether an exception is thrown or not:try: #some code here except: handle_exception() finally: do_cleanup()If the cleanup is to be done in the event of an exception, we can code like this:should_cleanup = True try: #some code here ... Read More
Manogna
2K+ Views
It is possible to define multiple exceptions with the same except clause. It means that if the Python interpreter finds a matching exception, then it’ll execute the code written under except clause.In general, the syntax for multiple exceptions is as followsExcept(Exception1, Exception2, …ExceptionN) as e:When we define except clause in ... Read More
Manogna
179 Views
The assert statement has the following syntax.assert , The line above is read as: If evaluates to False, an exception is raised and will be output.If we want to test some code block or an expression we put it after an assert keyword. If the test passes or ... Read More
Manogna
562 Views
For given code the output is as followsb = 30 a = ['10']In this case, "a" seems to be passed by value, because the value is unchanged even after the call to the function. So it is clear that the arguments have been passed by value in the python function.
Manogna
485 Views
A syntax error happens when Python can't understand what you are saying. A run-time error happens when Python understands what you are saying, but runs into trouble when following your instructions. This is called a run-time error because it occurs after the program starts running.A program or code may be ... Read More
Manogna
411 Views
Python not only insists on indentation, it insists on consistent indentation. If we indent one line by 4 spaces, but then if we indent the next by 3 (or 5, 6, .), we get this error of unexpected indent in python.In the given code, line 3 has more spaces at ... Read More
Manogna
291 Views
We catch multiple exceptions in one except block as followsAn except clause may name multiple exceptions as a parenthesized tuple, for exampletry: raise_certain_errors(): except (CertainError1, CertainError2, …) as e: handle_error()Separating the exception from the variable with a comma still works in Python 2.6 and 2.7, but is now deprecated and ... Read More
Manogna
313 Views
It is found that if python code is run normally and then if it is run in a python function, it runs faster in the latter case. I want to know why python code runs faster in a function.It is generally found that it is faster to store local variables ... Read More