Python development [Chapter 7]: Python exception handling and python exception handling
I. Exception Handling
1. exception basis
In the programming process, in order to increase friendliness, when a program encounters a bug, the error information is generally not displayed to the user, but a prompt page. In other words
Preliminary Exploration of the interface testing framework-python Series 7 and python
Click "Blue name" under the title to quickly follow
What we insist on is sharing, moving knowledge, showing everyone's progress, no paid training, no fake information, and paying attention and forwarding if you like (free to help more partners) if you want to know more, please
Python basics 7: python BasicsI. Data Type Supplement 1. str
#1. casefold # usage: S. casefold () # meaning: the lower () method is only ASCII encoded, that is, 'a-Z', effective for other languages (non-Chinese or English) can only use the casefold () method # usage: s = 'abbby' print (s. casefold () # abbex #2. expand
elements and inserts elements quickly6. Sequence Unpacking:' Vttalk ' ' female ' ' [email protected] ' = P7 . Traverse the dictionary key and value for inch D.iteritems (): Note: Iteritems returns an Iterator object, only the items method in Python3, equivalent to Iteritems Print ' ---> ', V8. Chain comparison operation: If Guess:>>> false = = False = = True (The answer is: false)9,if/else three mesh operation:' male ' if ' male ' Else ' female '10, truth value judgment:if If attr = = True:if
Python learning notes (8) Python list (2), python learning notes
List Functions
Append and expand
List. append () append a new object to the end of the list.
1 >>> dir (list) # list functions 2 ['_ add _', '_ class _', '_ contains __', '_ delattr _', '_ delitem _', '_ delsli
Python note (7): dictionary, class, attribute, object instance, inheritance, python instance
(1) Brief Description
A dictionary is a Python built-in data structure that associates data with keys (for example, name: Zhang San, name is a key, and name is data ). For example, the following is a dictionary.
{'Name': 'zhang
Python learning notes (11) Python statements (2), learning notes python statements
For Loop statement
Basic knowledge
A for loop can traverse projects in any sequence, such as a list or a string.
Syntax:
For Loop rules:
Do something
1 >>> for I in "python": # Use the I varia
The main reason for using the Python interface to run the Caffe program is that Python is very easy to visualize. So it is not recommended to run Python programs under the command line. If you want to run under the command line, you might as well just use C + + instead.It is recommended to use tools such as Jupyter Notebook,spyder to run
Python advanced (7): Object-oriented advanced, python advanced object-oriented
Learned the inheritance, polymorphism, and encapsulation of the three object-oriented features. Today, let's take a look at some advanced object-oriented content, reflection and some built-in functions of classes.
I. isinstance and issubclass
Class Foo: passclass Son (Foo): passs = So
Basic Python syntax [2]: getting started with python to proficient in [4], and getting started with python to proficient
The Python basic syntax of the previous blog has been introduced in [2] as a beginner in
Python core programming version 2, 36th page, Chapter 2 exercisesThe answer here is not from official resources, but from my own exercises, which may be incorrect.
2.21 exercise
2-1.Variables, print, and string formatting operators. Start the interactive interpreter, assign values to some variables (string, value, etc.
When using Python for data analysis or processing, it is often necessary to use a package, which must be installed before you can use it. The Anaconda installation package contains a number of commonly used packages that meet most of the requirements, such as numpy, Pandas, matplotlib, and so on, so you do not need to install them separately. But some of the less common, or niche, package needs to be instal
Data Structure and algorithm Python language description Chapter 2 first question (python version), Introduction to algorithms Chapter 2 answer
Question:Defines a Time classA) Time (hours, minutes, seconds) to create a Time object;B) t. hours (), t. minutes (), t. seconds () respectively return the hour, minute, and se
Python learning notes (10) Python collection (2), python learning notes
Common methods of collection
Add () adds an element to the set. If this element already exists in the Set, this method will become invalid.
1 >>> help (set. add) 2 Help on method_descriptor: 3 4 add (...
Python Learning (7) Object-oriented-encapsulation, python object-orientedPython class Encapsulation
Taking on the definition and instantiation of the Student Class in the previous section, each instance has its own name and score. Now if you need to print a student's score, you can define the function print_score ()
This function is an out-of-class function, as
installation of the NUMPY,SCIPY package is not available, so the online search solution.Did not find a good way, then I found the anaconda, opened the door of a new World ~Anaconda comes with a variety of Python packages that address the intricacies of installing Python packages. It's a friend of Python.First Officer
. It can be used to repeatedly execute a code block when any condition is true. However, sometimes you need to tailor your clothes. For example, you need to execute a code block for each element of a set. In this case, you can use the for statement:
Words = ['on', 'is ', 'any', 'x', 'Parrot']
For word in words:
Print (word)
================================== RESTART: E:/python/pyth/. py =
This
Is
An
Ex
Parrot
It can be seen from the above sentence th
Basic Python Syntax: getting started with python [2] and getting started with python
In the previous blog, we set up a python development environment in Windows. Getting started with python, we have already set up a
Python Study Notes (7) and python Study Notes
1. dynamically add attributes and methods to a class:
1. dynamically add attributes and methods to an instance:
The method bound to an instance does not work for another instance.
Class Student (object): passs = Student () s. name = 'Michael '# dynamically bind an attribute print s to the instance. namedef set_age (se
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.