(
)
This method returns a tuple of column names. Immediately after a query, it's the first member of each tuple in cursor.description.
New in version 2.6.
The following examples illustratein [+]: cx.row_factory = sqlite3. Rowin [+]: c = cx.cursor ()in [+]: C.execute (' select * from Catalog ')OUT[32]: In [all]: R = C.fetchone ()in [+]: type (R)OUT[34]: in [+]: ROUT[35]: In [approx]: print R(0, ten, U ' \u9c7c ', U ' Yu ')In [PNS]:
as a basis for dividing two classes. In combination with P/R analysis, the selection of threshold value can be more flexible and excellent.As you can see, if you choose a threshold that is too low, more test samples will be divided into 1 categories. Therefore, the recall rate can be improved, obviously the accuracy of the sacrifice of the corresponding accuracy rate.In this example, perhaps I would choose 0.42 as the dividing value-because the accuracy and recall rates are high.Finally, give s
First, what is an adornerAdorner, which is itself a function.The function of the adorner is to add some functionality to the existing function without changing its invocation mode, which is generally common.It is often used in scenarios where there is a need for facets, such as inserting logs, performance testing, transaction processing, caching, permission checking, and so on. (This quote: https://zhuanlan.zhihu.com/p/25648515)Second, the prerequisite knowledge of learning decorators1. function
CollectionYou can create a collection with Set (), or directly with {}Set_a = Set ([1,2,3,4,5]) Set_b = {1,3,5,7,9}print (set_a) print (set_b) print (Type (set_a), type (set_b))The collection also has a variety of operations, which can be recorded in several symbols. Check it out when you get to the other.Set_a = Set ([1,2,3,4,5]) Set_b = {1,3,5,7,9}print (set_a | set_b) # and set print (Set_a set_b) # intersection print (set_a ^ set_b) # Symmetric difference print (set_a-set_b) # difference se
The path to learning in Python -2018/7/10
Blog Development Project Flow? In general, a project development process is divided into: Project requirements, design table structure, functional development, testing functions, products on-line, the study of the blog Park as the blueprint for the development.1. Project RequirementsThe development of the blog needs mainly the following points:
Implemen
'].append (i)Panax Notoginseng Else: -dic['K2'].append (i)defaultdictFour, can be named tuple (namedtuple)Depending on nametuple, you can create a type that contains all the functions of a tuple and other features.1 #T = (one, one, one, one)2 #name adddress gender Email similar to coordinates3 #t.name equivalent to t[0]4 5 ImportCollections6 7 #create a class that works like Defaultdict8Mytupleclass = C
to multiple elements.Assuming that the function object returns True, the elements of that secondary are stored in the returned table. Filter filters the data by a function that is read in.Such as:Def fun3 (a): if a >: return True else: return falseprint filter (FUN3, [10,20,100,110])Output:[+]Four, reduce () functionThe first parameter of the reduce function is also a function, but there is a requirement that the function itself can receive two of the parameters.Like what:Pr
Python Study Notes 2: python Study Notes
Chapter 4 for and while Loops
1. for is faster than while. The author of the python learning manual has been restarting to emphasize this.
2. A lot of for usage
A. for x in list:, similar to foreach in C #, but the modification to x c
first. >>> import JSON >> > Dordereddict ([( " foo , 1), (" bar , 2), (" spam , 3), ( ' grok , 4)]) >>> Json.dumps (d) " {" foo ": 1," Bar ": 2," Spam ": 3," Grok ": 4} >>> Add: Ordereddict internally maintains a doubly linked list, which arranges the position of the keys according to the order in which they are added. The first newly added element is placed at the end of the list, and subs
int (integral type)The number of integers is 32 bits and the value range is -2**31~2**31-1, which is -2147483648~2147483648Long (integer)Unlike the C language, Python's long integers do not refer to the positioning width, i.e. python length does not limit the size of long integer values,But in fact, because of the limited machine memory, we use a long integer val
joined, one at a time.Add the Leader's name to the group Leader's notesAsk you to print a person every other person>>> name = [' Alex ', ' xiaoming ', ' Rain ', ' Eric ', ' Monica ', ' Fiona ']>>> Name.insert ( -1, "xiaochuan")>>> Name.insert (5, "dachuan")>>> name[3:8][' Eric ', ' Monica ', ' Dachuan ', ' Xiaochuan ', ' Fiona ']>>> Name.remove ("Fiona")>>> Name[' Alex ', ' xiaoming ', ' Rain ', ' Eric ', ' Monica ', ' Dachuan ', ' Fiona ']>>> del name[4:6]>>> Print (name[::
I. digress
Previously, I vowed that this series of notes would be completed in May, but now it is almost impossible. Why is this happening? I have reflected on the following:
1. The learning route is not firm:
Python, Django, mysql, and jquery later, disrupt the original plan.
2. Unclear objectives:
I don't know how much I want to achieve, what functions I want to implement, and so on, which leads to poor b
1. Scope of variables(1) Variables defined within a function include arguments, function only within the scope of the functions, and local variables are similar.(2) Global variables, inside functions can be called outside the function, even if the variable is defined after the function.Note: Local variables and global variables are defined in the same way as other languages.If you modify a global variable within a function Zjh,
Evaluates any string as a Python expression:Eval () Method:Eval (source[, globals[, locals]), valueEvaluate the source in the context of globals and locals.The source may be a string representing a Python expressionOr a code object as returned by compile ().The globals must be a dictionary and locals can is any mapping,Defaulting to the current globals and locals.If only globals are given, locals defaults t
, world' >>>. lower () # all lower case 'hello, world' >>>. capitalize () # upper-case letters, and lower-case 'hello, wold' >>>. istitle () # whether the first letter is in uppercase. If True is returned, FalseTrue is not returned. >>> a 'hello, wold' >>> B = "hellow, world" >>> B. istitle () # returns falseFalse if the first letter is not in upper case>. islower () # whether all strings are in lowercase. If true is returned, falseFalse is not returned. >>> B. islower () True
It seems that this
the matched string at the index position(expand) (template)Substituting the matched grouping into the template and then returns. The template can be grouped using \id or \gm = Re.search (R ' (\w+)! (\w+) (\w+) ', ' hman! How finny! ') #将匹配的结果带入 print M.expand (R ' resut:\3 \2 \1 ')>>> Resut:finny How HMan(groupdict) ([Default=none])The function is to assign all the groupings that match to and specify the alias, alias as key, match the string to value
Python advanced (8): common module 2 + exception handling, python advanced
Some time ago I talked about a lot of modules. I didn't talk about objects at the time. I didn't talk about them today. I also talked about exception handling.
I. hashlib Module
Python hashlib provides common digest algorithms, such as MD5 and
I want to learn Python with my colleagues. I want to talk about small functions (2). I want to learn python.
The title of the previous lecture and this lecture is "big topic and small functions". The so-called big topic is that if these functions are traced back, they will find things that sound higher. This kind of thinking definitely inherits the fine tradition
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.