Getting started with "Safe cow learning Notes" python

Source: Internet
Author: User
Tags arithmetic operators bitwise operators mathematical functions natural logarithm ord square root

First Lecture python Getting Started with

The 1.python version can be divided into 2.x and 3.x

python3.x disadvantages are not backwards compatible

2. Advantages of using python:

Simple syntax, high readability, high development efficiency, no need to compile, good portability, etc.

3. What you can do with python

system programming, user graphics interface,Internet scripting, database programming, etc.

4.python Parser

The Shell is our common parser, one-by-one execution of statements

5. the use of single and double quotes is basically the same, with \ n or "(" "") to Wrap, with # to annotate

>>> a= "Hello \ n World"

>>> Print (a)

Hello

World

>>> a= "' Hello

World ""

>>> Print (a)

Hello

World

Second lecture python types and operations of - Mathematics (I.)

1. Number Types

python3.x version integers have only one type.

Binary :0b or 0B bin (x)

octal:0o or 0O Oct (x)

16 binary:0x or 0X hex (x)

Int (str,base) base is 2,8,16 number

Repr (x): display mode when interactive mode

plural:complex (3,5) or 3+5j

Score: Fraction (3,5) or 3/5

2. operators:

Arithmetic Operators

Comparison operators

Assignment operators

Bitwise operators

logical operators

member operator : In,not in

identity operator:is, was not

Third Speaking python types and operations of - Mathematics (ii)

1. Operator Precedence

* * 2**100 is a 2 - Time Square

+,- plus and minus are unary operations

Multiplication

Add and Subtract

Wait a minute

2. Import Functions

Fraction () function

From fractions import fraction

Random () function

Import Random

3. Basic Mathematical Functions

Pow: power function

Abs: Absolute Value

Fabs: Absolute Value

Round: Rounding

Ceil,floor: rounding (math)

Int,bin,oct,hex,float: format Conversion

Random: Stochastic function

CMP: comparison function

LOG: natural logarithm

Max,min: Select Maximum, minimum value

MODF: Dividing floating-point numbers into small-tree and integer-parts

Sqrt: square root

Fourth Lecture python types and operations of - Introduction to Dynamic Types

1. in python , the variable has no type

A variable is a pointer to an object

object is a piece of memory allocated

A variable is a reference to an object

2. Collection of Objects

3. Shared References

Two variables can share an object

Shared references for lists

>>> list1=[1,2,3]

>>> List2=list1

>>> list1[0]=24

>>> List2[0]

24

>>> list1=[1,2,3]

>>> list2=list1[:]

>>> list1[0]=24

>>> List2[0]

1

4. >>> a=3.14

>>> b=3.14

>>> a==b

True

>>> A is B #a and b do not share an object

False

5. you need to know how many times an object is referenced and can be viewed using the following function

>>> Sys.getrefcount

>>> Sys.getrefcount (1)

Fifth Lecture python types and operations of - string (i)

the string in 1.python is divided into immutable sequences.

2. string constant - escape

escape character:\

Raw string:r "my\new" # \ does not escape

\ \: Two backslash essentially represents a backslash, the first backslash means escape

\ ': Single quote

\ ": double quotation marks

\a: Bell

\b: backward (one person)

\f: page Change

Wait a minute

3. in python3.x , the default is Unicode

>>> Len (" Chinese ")

2

4. string Manipulation

convert strings into corresponding code with Ord and CHR

>>> Ord (' a ')

97

>>> chr (97)

A

5. >>> a= "This is test"

>>> A[0:4]

' This '

>>> A[4]

‘ ‘

6. display the previous line : Alt+p (previous)

Show Next line:Alt+n (Next)

Sixth lecture python types and operations of - String Method

1. string Method - method call

Case-sensitive

>>> "Hello". Capitalize ()

' Hello '

>>> "HelloWorld". Title ()

' Hello World '

>>>

Typesetting related

Find related

Format judgment

Character separation

2. string Formatting expressions - formatting code

Seventh Lecture python types and operations of - string Formatting Expressions

usage of format in 1.python

>>> ' What does youlike,{0},{1},{2} '. Format (' spam ', ' egg ', ' ham ')

' What does you Like,spam,egg,ham '

2. >>> Import sys

>>> Sys.platform

Eighth lecture python discussion - string - a scene (i)

1. separating strings with multiple qualifiers

Import RE # introducing regular Expressions

>>> line= ' Who,what.when;where:whyhow '

>>> Import re

>>> Re.split (R ' [,.;: \ S]\s* ', line) #\s as a space

["Who", "what", ' when ', ' where ', ' why ', ' how ')

2. string start or end match

>>> url= ' Https://mylog.log '

>>> txt= ' Mytxt.txt '

>>>url.startswith (' https://', '/http ', ' ftp://')

True

>>> txt.endswith (' log ', ' txt ')

True

3. Match a string with a shell wildcard character

4. string matching and search

This note is for safe Cattle class student notes, want to see this course or information security of dry goods can go to safe cattle classes


security+ Certification Why is the Internet + era of the most popular certification?

Manifesto first introduce you to security+


security+ certification is a neutral third-party certification, the issuing agency for the United States Computer Industry Association CompTIA, and CISSP, ITIL and other common inclusion of the international IT Industry 10 Popular certification, and CISSP emphasis on information security management, compared to security+ Authentication is more emphasis on information security technology and operations.

This certification demonstrates your ability to network security, compliance and operational security, threats and vulnerabilities, application, data and Host security, access control and identity management, and encryption technology. Because of its difficult examination difficulty, the gold content is high, has been widely adopted by global enterprises and security professionals.

Why is security+ certification so hot?

Reason three: grounding gas, international stylish, easy to test, moderate cost!

As the most influential global leader in the global ICT sector, CompTIA is professional, fair and impartial in the field of information security talent certification. Security+ certification is highly operational and closely related to the daily work of frontline engineers. Suitable for banks, securities, insurance, internet companies and other IT-related personnel learning. As an international certification in 147 countries around the world are widely recognized.

Under the current tide of information security, talent is the key to the development of information security. and the current domestic information security personnel is very scarce, I believe security+ certification will become the most popular information security certification.


This article is from the "11662938" blog, please be sure to keep this source http://11672938.blog.51cto.com/11662938/1983559

Getting started with "Safe cow learning Notes" python

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.