BasisCharacter encoding
Character: The character is a unit of information, it is a general term for all kinds of words and symbols, including national text, punctuation, graphic symbols, numbers, etc.
Character set: The character
"""@author:P Eng (non-original)Reference: http://python.jobbole.com/81519/Record: Development history"""Recently writing an Android APP, you need to download the data on the server. Some PDFs, if transmitted directly, will increase the amount of
File operationsF_open=open ('*.txt','r')# opens in read-only mode (r) *. TXT file (required with PY file in the same directory, if different directories, need to write full path)f_open.close ()# close FileThe mode of opening the file is:
1 lists (list)The following code assigns a variable to a lista=['laay','aay','ay',' y']There are indexes in the list that can be indexed to access the values in the list, or you can complete the slices by indexingPrint (a[0]) Print (a[1]) Print (a[-
DescribeThe Python Strip () method removes the character specified by the string's Kinsoku (the default is a space).GrammarStrip () method syntax:Str. Strip([chars]); Parameters
Chars--Removes the character specified by the tail of the
Two days on business, take advantage of the passion to play Python againThe IDE will choose between Vs and Pycharm, and these two ides likeFirst, VSThe best way to develop python in VS is to get used to it. You can install PTVs, directly create a
import subprocess# executes the command, returns the command execution status , 0 or non-0retcode = subprocess.call (["Free", "-M"]) #返回值可判断执行是否正确, the command execution results are returned directly to the screen # Execution command, if the
I. What is set Set is an unordered, non-repeating sequenceTwo. Create a set(1) se={"123", "456"}(2) li=[11,22,11,22]Se=set (LI)Then se={11,22}Description: Set is a class, and the class name () is the __init__ method that executes the class.Note:
Read edit:f=open (' filename ', ' W ') opens a file directly and creates a file if the file does not existw: Open in write mode, A: Open in Append mode (starting with EOF and creating a new file if necessary)r+: Open in read-write modew+: Open in
1.python variable Case-sensitive2. Strings can be ' x ' "X" "X" "" "" X "" "3. String Merge with + signDifferent data types cannot be merged and need to be converted FirstString + String tonum + num CANstring + num NoString * num can4. A space in a
1.mkdir (path [, mode])Create only one directory, the upper directory does not throw an errorFunction: Create a directory that can be a relative or absolute path, the default mode is 0777. If the directory has multiple levels, the last level
Python Brief Introduction
Suitable field:
Web sites and various network services
System Tools and Scripts
As a ' glue ' language, the modules developed in other languages are packaged for easy use.
Not suitable for the
# #-*-coding:utf-8-*- import subprocessimport time,osdef createFile (filename): if os.path.exists (filename) = = False: open (filename, "a"). Close () if os.path.getsize (filename): pass else: f = open (filename , "a")
This article mainly introduced the Python development three kinds of operation mode detailed introduction of the relevant information, the need for friends can refer to the following
Python Three modes of operation
Python is a scripting language
1. Goal: Development of lightweight crawlers (excluding login and JavaScript asynchronous Loading)Do not need to log on static Web page crawl2. content:2.1 Crawler Introduction2.2 Simple Crawler Architecture2.3 URL Manager2.4 Web Downloader (urllib2)
Day 03, day
Key knowledge point: Function Definition, recursive function call, flag usage, eval () function
#! C: \ Program Files \ Python35 \ bin #-*-conding: UTF-8-*-# author: Frankdef search_backend (): search_list = [] # defines an empty list,
Python development [project]: large-scale simulated war games (alien intrusion), python war gamesAlien intrusion
Game Overview:
Now we are going to start a large-scale game with python to simulate the future war. The earth sniper aliens (in fact,
For details about how to judge Inf and Nan in Python, pythoninfnan
We all know that in Python, positive and negative infinity can be expressed in the following way:
Float ("inf") # positive infinity float ("-inf") # negative infinity
Exploitationinf(
Pathlib usage reference, pathlib referenceIf any error occurs, you must specify pathlib as path3.x. It has powerful functions and is easier to operate directories. For example, you can use this module to operate directories using python3.x.
Import
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