Magic and calculator

Operator

2018-12-11 00:45:43

24

1. + - * / ** In addition to the power take the remainder% / / rounded

2. determine the value of a thing or another whether in whole

if ,,, not in ,,, if,,,in,,,

Example: Example:

a=(“b” “c”) a=(“b” “c”)

if“b”not in a if“b”in a

print(1) print(2)

else else

print(2) print(1)

Third, the magic

1.test.copitalize () first letter capitalized

2.test.casefold( )

test.lower () uppercase to lowercase

test.swapcase () becomes uppercase lowercase

test.upperl( )

3.test.center () represents the width, center

test.l just () Left

test.r just () right of abode

4.test.strip () on both sides

test.lstrip () left

test.rstrip () to remove the left and right sides of the blank, / n, / t, may be specified character

5.test.count () to find the sub-sequence number string

test.find () to find the position of the string sequence, may be provided range

test.index () values ​​obtained in accordance with the position

6.test.endswith () to end ......

test.startswith () to begin ......

7.test.format (String placeholder = "sequence") format, instead of the string sequence placeholder

test.format-map ({: ""}) form Dictionary

8.str.maketrans( )

test.translate () in combination instead of replacing

9.test.replace () instead of new and old characters in character column column

10.test.expocndtabs () truncates the string

/ T Tab / n newline

11.test.isalnum () determining whether the presence of the string of letters and numbers

Whether test.isalpha () determines the presence of the string of letters and man

Whether 12.test.isdecimal () is determined with a digital string

test.isdigit () No. 1 and other support

test.isnumeric () supports digital capital

13.test.islower () determines whether the string lowercase

14.test.isprintable () to determine whether there is a string of characters not visible, you can not print

Whether 15.test.isspace () determine string are spaces, that is, the null character

16.test.istitle () to determine whether the title

17.test.title () to convert the string into the title

18.test.join () what is inserted into the string as: v = "a" .join ()

li.inse (position values) may be selected from the position of the insert

19.test.partition () first argument divided

test.rpartition () to the second argument divided

test.split () divided to each parameter, the parameter is not included

test.isplit () determines whether to split each of the parameters

test.splitlines () divided only in accordance with / n newline, true.false whether there newline

How many character string 20.len

The for loop format

for the variable name in a string

print (variable name)

Index: Refers to a string What is the first of several

Sections: a string of

The test ([0: 1])

21. Once the string to create can not be modified

By modifying or stitching, regenerates string

22.break end

contincle loop current

input wait for user input

23.li.extend () in the original Riga, you can also merge

li.append () in the original Riga

24.li.clear () Clear

25.li.copy () shallow copy, copy equivalent

() Between the conversion list, Ganso, character 26.li.tuple

27.li.pop () to delete the default mantissa and delete the value available

li.remove () to delete the specified

der delete

28.li.reverse () will reverse the current position

29.li, sort () to sort

Guess you like

Origin www.cnblogs.com/cui00/p/11432796.html