Retake course day6 (collection of python basics 4 and file operations ),
I. supplement the dictionary attribute Method
The key is of the constant type, and the dictionary can be quickly searched based on the hash index.
Immutable type int bool str tuple variable type: list dict set
1 clear: clear
# D = {#'k1 ': 'v1', # 'k2': 'v2' #}# d. clear () # print (d) # clear
2 Cory: Copy
# D = {#'k1 ': 'v1', # 'k2':
("Jerry"))#The statistics list contains the count of the stringnamelist.insert (0,"Lulu")#inserting data based on an indexPrint(NameList) namelist.sort ()Print(NameList)#Sort by askii code.Namelist.reverse ()#Reverse FlashbackPrint(NameList)Print(Len (NameList))#len (list) Gets the list lengthPrint(dir (list))#See what methods are available for list
List AdvancedNameList = [1,2,4,'OK','Yes']Print(Namelist[0:2])#The result is "0" and 2 for the index.Print(Namelist[0:2:2])#That means you can cu
1 defFun (ARG):2 Try:3Li =List (ARG)4 if(Sorted (li) = =li):5 Print('Sequential sequence up')6 elif(Sorted (li, reverse=true) = =li):7 Print('Reverse sequence down')8 Else:9 Print('None')Ten exceptException as E: One Print('you are not entering a sequence, please enter a sequence') A Python Basic Course: Define a function, enter a s
Python2.Calculate symbol AdditionsDivision sign rounding out the second partyCompare symbol Additions! = Not equal to Assignment Operation symbols+ = addition assignment operator a+=c equivalent to a=a+c-= subtraction assignment operator a-=c equivalent to a=a-c *= multiplication assignment operator a*=c equivalent to the a=a*c/= division assignment operator A/=c equivalent to the a=a/c%= the remainder assignment operator a%=c equivalent to a=a% **= the secon
A bit, a relationship with bytes.Bit: is the smallest representation unit of the computer.Bytes: is the smallest storage unit of the computer.1 bytes (bytes) = 8 bits (bit)Format:Print (bytes (' character ', encoding= ' Utf-8 ')) file read file by defaultOther functions of the second stripStrip remove the space on both sides, line breaks, tabs, and so on, you can also specify the deletion characterA= ' dsad ' Print (A.strip ()) b= ' \ndsfsadagh\t ' Print (B.strip ()) print (123) c= ' FSDFDS
2018 June , 21st Python Introductory Course learning experience Thanks to Alex's carefully prepared course content and beautiful PPT, summarize The main contents of the first lesson are :1. What do you learn from Python ? 2. What do you want to do after you finish your study?3, Py
default from several start print (key, iterm["Text"]) # Get course in the string, ready to do reflection while True: #***while This logical relationship is written in the fun, whil if shelf write the following instance Stu will not be recognized, in this fault, too pit n um = Int (Input ("Enter the function number to execute:") num = num-1 name = course.func_list[num]["Name"] # with hints from the enumeration, in relation to the user's input and enum
of the file need to do import Win32API, Win32con, introduce the relevant class
Modify the system registry function in fact, just a few lines ... Of course, because my factory must be through the proxy server to the Internet, so modify the system registry key value type I only use the REG_SZ this one, the actual other situation will have REG_DWORD ah and so on type.
Then I need a configuration file, to save various scenarios "QA AH development envir
information.Key-value pairs are tagged in the dictionary in such a way that: D = {key1:value1, key2:value2}. Note that their key/value pairs are separated by colons, and each pair is separated by commas, all of which are included in curly braces. Also, remember that the key/value pairs in the dictionary are not sequential. If you want a particular order, then you should sort them yourself before using them.Instance:#coding =utf-8Dict1={' Zhang ': ' hellos ', ' Wang ': ' Wangbaoqiang ', ' li ':
Applicable peopleAll-Stack Python devops development engineer for DevOps directionCourse overviewCourse Scope: Our courses include C01 to C05 five levels, including front-end knowledge, covering all the skills required to develop a qualified Python full stack engineer, plus a CA series additional lessons to help explain the development specifications and GIT usage, and keep up to date with some new knowledg
Python is a computer programming language, also known as glue language, can be used in a mixed compilation of C/c++/java and other languages such as libraries. You may have heard of many popular programming languages, such as C , which is very difficult to learn in college, a very popular Java Language in society, and Basic for beginners language, very suitable for the Java language of Web programming , and so on,
I am a photoelectric information science and engineering students, the professional name with "information", so my professional and computer language is inseparable from the beginning, I do not know the importance of machine language, learning C language, and not very serious learning, so the foundation is very poor, in the later experiments found that machine language also really play an important role, Machine language should have a common point, learn a machine language, but also for other la
angle Absolute angle: The x-axis relative to the canvasTurtle.seth (45) Turtle angle: Relative to the turtle's current orientationTurtle.left (angle)Turtle.right (angle) Color System Turtle is an RGB color system (with small values by default)Turtle.colormode (mode) #mode = 1.0 decimal value, mode=255 integer valueTurtle.colormode (1.0) Turtle.pencolor (1,1,0.4)analysis of grammatical elements of turtle libraryImportThe From library import function (*) #不用在前面加库名, but causes a function name
label as a numpy array of Python objects
Int64index
Special index for integers
Multiindex
A hierarchical Index object that represents a multi-level index on a single axis. Can be seen as an array of tuples
Datetimeindex
Memory nanosecond timestamp (denoted by NumPy's Datetime64 type)
Periodindex
Special index for period data (time interval)
2.2.d.1 Primary Inde
Write a function that meets the following requirements:A) Calculates the result of printing all parameters and multiplying the cardinality (base=3)b) If the last argument in the parameter is (base=5), the cardinality is set to 5, and the cardinality does not participate in the sum calculation.#-*-Coding Utf-8-*-def results (*i): sum=0 for J in I: sum + = J if I[len (i) -1]==5: c10/>sum= (sum-5) sum*=5 else: sum*=3 return Sumprint (results (1,2,3,4,5)) Little Turtle
It's almost 12 o'clock, and we've just processed two urgent data.Two kids are asleep, and they're a lot quieter.Lately I've been thinking that working overtime every day shouldn't be the meaning of life--it seems like crap.The meaning of life is to live and better continue.Work hard to keep working overtime in order to get the protection of lifeIt's not scientific to spend most of my time working overtime.1. Take care of your body this is hardware (perhaps one day the local does not need hardwar
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.