On the Internet to see the 2018 Forensic Science Reasoning Test, found that this is a good Python lianbi program, so the violence solved a bit.Answer: Bcacacdaba55 lines of code version:defCheck (L):#Q2t=[2,3,0,1] ifL[5]!=t[l[2]]: returnFalse; #Q3T=[l[3],l[6],l[2],l[4]] x=t[l[3]] T.pop (l[3]) ifXinchT:returnFalse; #Q4t=[(L[1],l[5]), (L[2],l[7]), (L[1],l[9]), (l[6],l[10])] ifT[l[4]][0]!=t[l[4
Title Description: 2018 Spring recruit-today's Headlines 5 questions (after the big guy answer-c++ version)Problem Solving Ideas:The most important thing to do is how to spell ' 1234567890 ', which can be achieved by using the Python built-in function eval () for input expression test results. use 5 strings to express ' 1234567890 ', as follows ( for good looks, the tab space is added )' 66666 .... 6 66666
to write to the file"" Defines writing data to the file function "" " forIinchrange (num): U=Ulist[i] with open ('D:/test.txt','a') as data:Print(U, file=data)if __name__=='__main__': List= [] # I previously put list=[] in the for loop of the Get_data () function, resulting in each loop emptying the list before appending the data, and finally traversing the last set of data ...URL='http://www.zuihaodaxue.com/shengyuanzhiliangpaiming2018.html'HTML=get_html (URL)Get_data (HTML, list)Write_data (
can improve compatibility3.1 Json.dumps () Import jsondic={'Alex':'+ '# Note the JSON-type string , all in double quotes, at which point the single quote a=json.dumps (DIC)print(a) {"Alex " " - "} # automatically outputs into double quotes, and is compatible with each platformThere is a shortcut, Json.dump (' Sjah ', f)The former is the data that needs to be written, and the latter is the file to be written, which is relatively fast3.2 Json.loads ()Take the JSON type string out, note that i
Assignment capitalizationThe ID is shared when the amount of data is smallerUser-to-Program interaction: input () receives user input and turns input into a stringComment: Explain code to enhance code readability.Single-line Comment: # Multiline comment "" "* * *" ""File Header: #! /usr/bin/env python (only for Liunx)#-*-Coding:utf-8Numeric type: int, floating-point number (decimal), float,String (description) str ("'") supports string concatenation
-price2 print(‘-------------------‘) for i in names1: num = names1.index(i) price = names2[names1.index(i)] print(num, i, price) print(‘-------------------‘) _abc=input(‘你是否要继续购物:(add)or(other)‘) else: print("you money is not enougy") breakprint("你购买的商品:",names3)print(‘你的余额:‘,salary)2. After the perfect procedureproduct_list=[(' Iphone ', 5800), (' Mac Pro ', 9800), (' Bike ', 8000), (' book ',
1.Module initialization1) Getpass ModuleProgram Examples:Import Getpass_password= ' Penny '_password= ' abc123 'Passname=input (passname:)Password=getpass.getpass ("Password:")If Passname=_passname and Password=_password:Print ("Welcome {name} loding ...". Format (Name=passname))ElsePrint ("Invarild Pass name or pass word")Python's own IDE terminal does not support the hidden echo, to use the system's terminal, such as the word cmd under Windows.Ps:CMD location: C:\Windows\System32\cmd.exeYou ca
corresponding to the same value, forming a dictionaryinfo='Alex's1={}v2=s1.fromkeys (info,222)print (v2) {'a'l'e ' ' x ': 222}4.5 get, returns value according to Key, if none is returned, the none can be modified info={'Alex': 123, 'a':'nishishei' ,'v': 555}#info= ' Alex 'v2= Info.get (567,222)print(v2)------222Because there is no key567, so return parameter, 2224.6 Pop (key, return default value)If there is no key, the default value is returnedIf there is, then delete and get4.7 Popitem ()R
.
ab+
Opens a file in binary format for appending. If the file already exists, the file pointer will be placed at the end of the file. If the file does not exist, create a new file to read and write.
Read filef = open ("f:/01.txt""R") # reads a file for in F.readlines (): # Traverse each line of the file print(i, end="" # outputs the contents of each line. Because the end of each line is \ n line break. Therefore, you do not need to ou
Mind Map of this article:Program
OrderFollow the orderFor example: Wash your hands first, eat again, and then wash the dishes.
BranchAccording to different circumstances, the condition satisfies the execution of the statement under certain conditions.For example: Wash hands first, if the rice did not do well, play games, if the meal is done, eat, if the rice has not done, called takeout.
CycleThe condition is fulfilled on a recurring, non-satisfied execution or no longer perform
The train ticket for the Spring Festival of 2018 is on sale today. You can use Python to grab a ticket and go home for the New Year.
Author protream
Original article: http://www.jianshu.com/p/f411d7e10c41
Note: This article is an article edited by protream and marvin.
First, let's take a look at how to quickly view the remaining train tickets?
When you want to query the train ticket information, do
the wrong suggested URLs because Python does not support encoding in the source file by default. The solution has the following three kinds:
1)在文件头部添加如下注释码: # coding=
Reference blog: Cnblogs csdn5.2 Question Two
Unicodedecodeerror: ' ASCII ' codec can ' t decode byte 0xe9 in position 0:ordinal not in range (128) Cause:
Because Python uses ASCII encoding by default, while
2018 at the beginning, it is spring. The saying goes, "spring." is another year of ambition.decided to study some web seriously. Would have preferred to learn nodejs. But there are too many of the Python books I've bought before. Let's talk about the resources we have at hand.Today, I started learning web Python test-driven development reading notes. Don't ask fo
neural networks through different configuration files. IX, Hebel hebel is a neural network library with GPU support that can determine the properties of a neural network through YAML files. Provides a way to separate the Divine Network and code-friendly, and run the model quickly, it is written in pure Python, is a very friendly library, but because of the development soon, on the depth and the vast, there is some lack! ten, Neurolab neurolab is a
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
The path to learning in Python -2018/6/14
1. Browser and serverThe process by which the browser sends a request to the server is the process of requesting, and the server responds to the browser as a response process.2. A simple Web applicationImportSocketsock=Socket.socket () Sock.bind ("100.113.14.43",8080)) Sock.listen (5) with Open("Index.html","R") asF:# First write the style to the HTML file, and
recursive neural network-based text notation word2vec. v. Orange VI, PyMVPA Vii. Theano Viii. PyLearn IX, Hebel ten, Neurolab neurolab is an API-friendly neural network library that contains different variants of the recursive neural network implementation, If you use RNN, this library is one of the best choices in a homogeneous API. python Development Engineer must know ten machine learning Library, in addition, there are overfeat, Nolearn an
,PRICE,ADDR): Self.name=name Self.priod=priod Self.price=Price self.addr=AddrclassTeacher:def __init__(self,school): Self.school=School##############School1=school ('Sdau','Beijing',{'Linux':'Class 1','python':'Class 2'})#The school is already there, let the students chooseSchool2=school ('Yingshangyizhong','Shanghai',{'Go':'Class 3'})#Create a courseLesson1=lesson ('python','50week', 150,'Beijing')#courses
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.