Collection (s). Method name
Equivalent symbol
Method description
S.issubset (t)
S
Subset testing (allows for a subset of non-strict meanings): All elements in S are members of T
Using Python can quickly get information about the system, such as the platform, byte order, and Python's maximum recursion limit, such as:Import sys# get byte orderprint sys.byteorder# get platform print sys.platform# Nothing to say ^_^ print
# 145 is a curious number, as 1! + 4! + 5! = 1 + 24 + 120 = 145.# Find The sum of all numbers which is equal to the sum of the factorial of their digits.# note:as 1! = 1 and 2! = 2 is not sums they is not included.Import timeStart = Time.time ()L = [
1. Download the ReadLine moduleHttp://newcenturycomputers.net/projects/readline.html2. Install Readlinemodule3. Edit and configure Pythonstartup file%userprofile%, this is a system variable, the path is the C:\user\ user name \# Python startup
Recently began to learn python, people learn a language imperceptible First command often that is Hello world!Here too, using Python to write a small reptile, climbing sister pictures of the "photos." The sense of efficiency is slow, it should be
There are a lot of different data structures in Python, such as list,tuple,set,dic, why do I have to speak set alone?Because set is a relatively easy-to-forget data structure, not only in Python, but also in C + +, I rarely use set anyway. But after
1. Algorithmic thinkingn elements, assuming that the first I element is already ordered, the smallest element from i+1 to n elements is placed in its final position in the ordered table2. Code implementation(1) Non-recursive callsdefSelectionsort (A,
You can write a generic adorner that catches exceptions, and you can continue to perform subsequent actions when the program has an exception. This is especially appropriate for validator programs that use a large number of assertions.The
Cycle:The execution of a piece of code repeats n times until a certain condition is met.In order to stop repeating execution at the appropriate time, the program needs to have a condition that satisfies the stop loop.There are three loops in Python (
0. SequenceLists, tuples, strings are sequences.There are two features of the sequence: index operator and slice operator. The index operator allows us to fetch a specific item from the sequence. The slice operator allows us to get a slice of the
1.python string can be used "AAA", "AAA", "" "" AAA "three Ways to expressThe escaped string in 2.python is "R", and C # is @ character-by-word3. Use index to get a character for a string: such as String str= "abcd123456", use str[3] to get a
1 Installing PythonVerify2 Installing DjangoVerify that the Django installation was successful: Django-admin Startproject demo, a demo folder will be generated under the current pathGo to the Demo folder, Python manager.py runatserver 8080Then the
Python:data EncapsulationThe following table shows the different behaviour:
Name
Notation
behaviour
Name
Public
Can is accessed from inside and outside
_name
Protected
Like
11 Resources for Python programming and 11 for python Programming
Writing code with Python is not difficult. In fact, it has always been called the easiest programming language to learn. If you are planning to learn web development, Python is a good
Python file processing,
Related APIs:
Folder:
Obtain the current working directory, that is, the directory path of the current Python script:OS. getcwd ()
Returns the names of all objects and directories in the specified directory:OS. listdir ()
The
Class inheritance code instances in Python, and python inheritance code instances
Compared with C ++, Python is simpler and more efficient. Below is a simple example of Python inheritance.
Copy codeThe Code is as follows:#! /Usr/bin/python# Filename:
Python string formatting study notes, python Study Notes
In python, the % operator is used to format the output string. The common format is
• Mark the string % value group to be output in the formatThe "format mark string" on the Left can be
Python File Operations
I. Common Methods of operating OS modules and shutil modules for files and folders in python.1. Get the current working directory, that is, the directory path of the current Python script: OS. getcwd ()2. Return all files and
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.