? Python Learning Diary: Day1

1, the Computer FoundationCPU: Equivalent to the human brain, used for computing. Memory: Store data, run fast, high cost, power loss data disappear.HDD: SSD (FAST), mechanical hard drive (with pointer). Storing data, requiring long-term data

Usage of reduce Python

1. View the usage of reducein the Python command viewImportfunctools Help (Functools) to help (functools.reduce) or fromFunctoolsImportreduce Help on built-inchfunction reduceinchmodule _functools:reduce (...) Reduce (function, sequence[,

Python Text Processing---Calculate the number of different amino acids in the Fasta file

#::!/usr/bin/python3#-*-coding:utf-8-*- # calculate the content of each amino acid in the Fasta file ImportSysargs=SYS.ARGVF=open (Args[1],'R') FW=open ('OUT.txt','W') Line=f.read () txt="'. Join (Line.split ('\ n') [1:])#can get the amino acid

Python regular-expression learning

ObjectiveRecently in a function with Django, mainly for the realization of machine monitoring, the process, involving the URL to identify IP routing problems, the beginning with a variety of expressions can not be properly routed to the IP,

Python solution leetcode:33. Search in rotated Sorted Array

Title Description: Finds the given value in a rotating array, where the rotated array does not contain duplicate values; Ideas: The first iteration of the binary, the index of the smallest value in the array is found; The

Python Smart contract Log operations

from__future__ImportUnicode_literalsImportJson fromTimeImportSleep, Time# chinese CodedefEncode_str (_STR):Try:return ByteArray(_str,"Utf-8").Hex()except Exception asE:Print(e)# Chinese decodingdefDecode_str (_STR):Try:return ByteArray. Fromhex

python--Additional study notes (ii)

File processing# in-file move the Seek () method can move a file pointer in a file to a different location, the offset byte represents a position offset relative to a location, the default is 0, the representation starts at the beginning of the file,

Python XML to Excel

Due to the company's business needs, temporary write a piece of code: fromXml.etreeImportElementTreeImportxlrdImportXLWT#Read XMLdefread_xml (path):Print("read_xml start ...") Root=elementtree.fromstring (path)#read row child noderows = Root.findall

Python compresses files/folders with Python

"Python compressed folder" Import "ZipFile" module1 defZip_ya (startdir,file_news):2Startdir =". \\123" #the folder path to compress3File_news = Startdir +'. zip' #the name of the folder after compression4z = zipfile. ZipFile (File_news,'W',

Brother Lian Learning python error and exception handling

# Common Exceptions classHuman:#PropertiesSex ='Mans' Age= 18#Method defRun (self):Print('Run, ~ ~ ~')#instantiating an object#ZW = Human ()#print (zw.age)#Attributeerror attempting to access an unknown object property#print (Zw.color)#lists = ['

Python built-in module--collections

Python built-in modules--CollectionsCollections is a python built-in collection module that provides a number of useful collection classes.NamedtupleWe know that we tuple can represent immutable collections, for example, two-dimensional coordinates

python-sending mail

python sends mail using the Smtplib module, which is a standard package that can be used to import direct imports and use Email.mime to process message content and attachmentsImportSmtplib,os fromEmail.mime.textImportMimetext

Python Two-point lookup problem Set

Leetcode34 Search for a RangeclassSolution:defSearchrange ( Self, Nums, target):""": Type Nums:list[int]: Type Target:int: Rtype:list[int] """ if notNumsreturn[-1,-1]defSearch (n): St= 0Ed= Len(nums)- 1

Python Regular Expressions

1. If the special characters are literal in use, they need to precede them with a backslash (\) and special characters include \. ^ $ ? + * { } ( ) [ ] |2. If you want to match any one of the character sets, you can use the character class to

Python sequence and map unpacking operations

Unpacking is to extract each element of a sequence or map separately, and a simple use of a sequence unpacking is to extract the first or previous elements separately from the following elements, for example:First, seconde, *rest = sequenceIf there

python--palindrome function (reversed)

Palindrome number: The positive and reverse permutations result in equal (i.e., left-to-right and right-to-left results are equal), for example: "123321", "0000" and so on.Reversed function: Reverses a Sequence object and constructs its elements

Requests crawl Baidu paste: Python beauty 3

Import Requestsimport Sysclass Tieba (object): Def __init__ (self, tieba_name, pn): Self.tieba_name = Tieba_name Self.base_url = ' https://tieba.baidu.com/f?kw=%spn= '% (tieba_name) # print (Self.base_url) self.url_li st = [] for i in range

Python programming Exercise: The arithmetic of a leaky device

When I read the last "what to learn" in the concise Python tutorial, I discovered that it was a graphical tool, and that if you mastered the previous chapters, you could write most programs = =! Well, I've been reading books and haven't written any

Python Crawler requests Judge request timeout and resend request

In the execution of the crawler, there will always be a request connection timeout situation, the following code block in the case of a request time-out, catch a time-out error and continuously send multiple requests, only to the request to connect

Example analysis of Python cross-file global variables implementation method

When we use Python to write applications, we sometimes encounter situations where multiple files pass the same global variable. Therefore, the following article mainly introduces you to the Python cross-file global variable implementation method,

Total Pages: 4013 1 .... 2723 2724 2725 2726 2727 .... 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.