Parameters of the Python basic 4.1 function

#/usr/bin/python#coding =utf-8# @Time: 2017/10/24 9:09# @Auther: Liuzhenchuan# @File: Parameters of the function. PY#比较参数x, the size of ydef Fun (x, y): if x>y: print x elif x print y Fun (6,7) >>> 7Fun (8,4) >>> 8# #函数应用异常处理def Fun ():

Python Learning path: File manipulation

Basic file Operation:Open, read, append, close#data = open ("Yesterday", encoding= "Utf-8"). Read () #打开并读取文件f =open ("Yesterday", ' R ', encoding= "utf-8") #文件句柄data = F.read () print (data) f=open ("Yesterday2", ' W ', encoding= "Utf-8") #写文件f.

Python Learning Path: the use of collections

Set Relationship test:List_1=[1,4,5,7,3,6,7,9]list_1=set (list_1) #去重list_2 =set ([2,6,0,66,22,8]) print (List_1,type (list_1)) #集合是无序的print (list_1,list_2) Print (List_1.intersection (list_2)) #交集print (List_1 & list_2) #交集print (List_1.union (list_

Urlparse module (Python module)

Introduction of Urlparse ModuleThe Urlparse module mainly splits the URL into 6 parts and returns the tuple. And you can make the split part a URL again. The main functions are Urljoin, Urlsplit, Urlunsplit, Urlparse and so on.Second, Urljoin

Python--operators and manipulating objects

1. Arithmetic operators(1) + (SUM)>>> 2 + 35(2)-(poor)>>> 3-21(3) * (quadrature)>>> 3 * 26(4)/(for business)>>> 3/22.5(5)% (modulo)>>> 3% 21(6) * * (exponentiation)>>> 3 * * 29(7)//(for finishing)>>> 3//212. Comparison operators(1) = = = (equals)>>>

Python Data structure

Python data structures are mainly: list lists,1, List(1) Basic methodsPrint("lsit List of PYTHON data Structures") A=[66.34,666,666,1,25.6]Print("list.count (x) returns the number of occurrences of x in the list:", A.count (666), A.count (66.34),

Writing a login interface using Python

# Create date:2017.10.31 Tuesday# Author:eric Zhao#-*-Coding:utf-8-*-‘‘‘Writing the Login interfaceEnter User name passwordShow welcome message after successful authenticationThree-time error after locking‘‘‘Login_user = input (' Please input user

Python Basics-Common modules

Time module : Timestamp, time string, time object, and how to convertRandom module : Randomly decimal, Integer, interval, random list elements, scatter listOS module : An interface that interacts with the operating system, os.path the path to the

Python's Django Deployment

Django Deployment:1. Rent a cloud Server2. Buy a serverRent: Public network ip,111.13.101.208Leased domain: www.pythonav.com 111.13.101.2083. Writing code4. Copy the code to the server [Python,django,pymysql,sqllite]5.settings.pyallowed_hosts = ['

Python Exercises (ii)

1. Sort a list of numbers from small to large, then write to the file, then read the contents of the file from the file, and then reverse-order it in the next line appended to the file.import codecsl1=[22,32,5,88,43,20,18,99,201,100,302]l2=[]print  '

5 python--file Processing

One, the file operation#打开文件需要几步#1. Open FileF=open (' 1.txt ', ' R ', encoding= ' utf-8 ')#2. File operation (read or write), manipulate file handle by handle = open (' File path ', ' mode ')File=f.read ()#3. Closing filesF.close ()Second, read the

Python modifies file content functions

Since Python does not have a way to modify the contents of a file, it has written two functions to modify the contents of the file.ImportOSdefChange_file (address,line,content):#Modify a file to specify a lineF=open (Address,"R", encoding="Utf-8") F2

Python various Project module records

1. Create a Web application, the Django Web Framework (HTTPS://DOCS.DJANGOPROJECT.COM/EN/1.4/INTRO/TUTORIAL01)2. SciPy (http://www.scipy.org), if you are interested in science, mathematics, engineering, can look. If you want to combine scipy to

Python Study Notes _ 03: simple operations on MongoDB database, _ 03 mongodb

Python Study Notes _ 03: simple operations on MongoDB database, _ 03 mongodb Directory1. Insert document2. query documents3. Update the document4. delete a document  1. Insert document # -*- coding: UTF-8 -*-import datetimefrom pymongo import

Python variable,

Python variable, Python variable It is very easy to define variables in python, for example, the following code: Name = "admin"; print (name ); The above is to define a basic variable. Here we will talk about some other things about the variable.

First week of Python learning, first week of python

First week of Python learning, first week of python I. My first program   print("Hello word!")   Therefore, python is a very concise language. Unlike c, c ++, and so on, you have to call a bunch of libraries to write a simple program. In addition,

Python input,

Python input, Python Input The input after python3 is different from that after python2.7. The input function is input ()   Username = input ("username"); password = input ("password"); print ("username", username); print ("password", password

Shorthand Boolean Value

Shorthand Boolean Value In python. Boolean values include true and False. True equals to true, and False equals to error. Note that uppercase and lowercase letters are strictly required in python. The first letter of true and False must be

Traverse dictionary and calendar dictionary

Traverse dictionary and calendar dictionary 1. Store dictionaries in dictionaries Cities = {'Guangdong province ':{'Guangzhou City ': ['China', '123', 'yangcheng'],'Shenzhen City ': ['China', '123', 'dynamic City'],'Zhuhai City ': ['China', '123',

K-Nearest Neighbor Algorithm

K-Nearest Neighbor AlgorithmOverview This algorithm classifies data by measuring the distance between different feature values. Advantage: high accuracy, no sensitivity to abnormal values, no data input assumptions. Disadvantage: The computing

Total Pages: 4013 1 .... 2739 2740 2741 2742 2743 .... 4013 Go to: GO

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.