Python function 01

# no parameters and returned functions def say_hi (): print ("hi!") Say_hi () Say_hi () # has parameters, no return value Def print_sum_two (A, B): C = a + b print (c) Print_sum_two (3, 6) def hello_some (str): print ("Hello" + str + "!")

Python tuple tuples

# One, create tuple # Tup1 = (' Physics ', ' Chemistry ', 1997, #) # tup2 = (1, 2, 3, 4, 5) # tup3 = "A", "B", "C", "D" # tuples containing only one element, need to be Add a comma after the element to disambiguate # Tup1 = (50,) # Two, access

The use of the ' R ' before the string of Python learning

Open (R ' C: \ ... ') when opening a filePlus R and no ' R ' are different' R ' is to prevent character escaping if ' \ t ' in the path does not add r, then \ t will be escaped and added ' R ' after ' \ t ' can retain the original appearanceThe

Python Select sort

def choose_sort(raw_list): """对列表选择排序""" # 循环次数控制n-1 for times in range(len(raw_list)-1): # 循环开始先假设第一个元素为最小值 min_value = raw_list[times] # 遍历列表中的无序部分 如果元素小于min_value 就给min_value重新赋值 if raw_list[times] Python

0 Basic White How do I use Python to make forms?

Using Python to manipulate excel in the work is still quite common, because after all, do not understand Excel is a user of large data management software. This paper uses python3! Before you share, small make recommend a very good exchange treasure,

Python producer consumer Model

Using multithreading and queues to implement producer consumer models#-*-Coding:utf-8-*-__author__ = "MuT6 sch01ar" Import threadingimport queueimport timeq = queue. Queue () def Producer (name): count = 1 while True: q.put

Python crawler-Crawl picture file learning on a single page

Tag:python    crawler     #! /usr/bin/pythonimport sys# Regular expression library import reimport urllibdef gethtml (URL):     page = urllib.urlopen (URL)     html = page.read ()      return html    def getimg (HTML):     reg =  r ' src= ' (.

Python Multi-process

Multi-process open multiple processes to execute scripts#-*-Coding:utf-8-*-__author__ = "MuT6 sch01ar" import multiprocessingimport timeimport threadingdef My_Thread (): Print ("Running Thread") def my_process (n): time.sleep (2) print

Python built-in methods

Positionhttps://docs.python.org/3/library/Built-in methods All (iterable) #所有的值都是真ReturnTrueAny (iterable) #任意一个值是真ReturnTrueASCII (object) #把内存诗句对象变成一个可打印的形式 Bin (int) #把数字转化为二进制, the return value is in string format BOOL () #判断真假 ByteArray ()

Python crawler Cookie

Because the HTTP protocol is a stateless protocol (if the login is successful when accessing other Web pages of the site, the login state disappears), the session information needs to be saved, through a cookie or sessionCookiesSave all the reply

Python--Ajax array delivery and background reception

Phper Turn PythonerIn the original use of PHP Web site development, the front-end Ajax to pass the data, is to pass an array directly in the past, the background with $_post[' key ' to receive it, did not consider so thin, think this is not a matter

Python exception type

LinkBaseexception+--Systemexit+--Keyboardinterrupt+--Generatorexit+--Exception+--Stopiteration+--Stopasynciteration+--Arithmeticerror|+--Floatingpointerror|+--Overflowerror|+--Zerodivisionerror+--Assertionerror+--Attributeerror+--Buffererror+--Eoferr

The fourth day of the snow Python

List of additions and deletions to increase the search. append () add element to list lastLi = ['Alex','wusir','Egon', ' Goddess ','taibai']li.append ('123') ) Print (LI). Insert () to insert an element at a specified locationLi =

Python, difficulty

develop a sensitive word filter that prompts the user to enter comments if the user enters content that contains special characters:#list of sensitive words li = ["Cang teacher", "Tokyo Fever", "Enrique", "Yui Hatano")#The sensitive words in the

Python Implements Snake

Snake's algorithm is still relatively simple, the movement of the snake I was by adding a head block, and then determine which direction should be added to the head of the snake, add the end of the tail to delete the line, if you eat food will not

Python full stack day9 (Python basics)

Python BasicsOne, Windows installation Python3.5: Https://www.python.org/ftp/python/3.5.2/python-3.5.2rc1-amd64.exeDouble-click Install in directory c:/python35Setting environment variablesAdd a newly installed Python directory later to open the

Python reads CSV file

Python has a package that reads and writes a CSV file, directly import CSVNew Test.csv1. WriteImport Csvwith Open ("Test.csv","W", encoding='UTF8') asCsvfile:writer=Csv.writer (CSVFile) writer.writerow (["Index","A_name","B_name"]) writer.writerows (

Python backs up the site and deletes the specified date file

#!/usr/bin/python# Filename:backup_ver1.pyImport OSImport timeImport datetime# 1. The files and directories to is backed up is specified in a list.Source = ['/software/tengine/html/mtax/sbzs ', '/software/tengine/html/mtax/static ']# If you're using

Python Basic Practice (i)

-*-paper on the end of the light, I know this matter to be gong. -*-#-*-Coding:utf-8-*-# Author:sweeping-monkName = "What is a string?" "what_is_a_string = "String is a series of characters, in Python, enclose the string in quotation marks, where

Python implementation of Kmeans algorithm

Clustering is a unsupervised learning, put similar objects into the same cluster, a bit like a fully automatic classification, the more similar the objects in the cluster, the greater the difference between clusters, the better the clustering effect.

Total Pages: 4013 1 .... 3113 3114 3115 3116 3117 .... 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.