Brush questions (3)

Topic one

What gets printed?()

print r"\nwoow"

A. new line then the string: woow
B. the text exactly like this: r"\nwoow"
C. the text like exactly like this: \nwoow
D. the letter r and then newline then the text: woow
E. the letter r then the text like this: nwoow

analysis

The prefix r of a string in Python represents the original string identifier. The special symbols in the string will not be escaped, which is suitable for the representation of complex special symbols in regular expressions. No r means that you want to escape to a newline. Generally, in order to output the string "\ n", there are two ways: add r in front or escape \ (ie "\ n")

answer

C

Topic 2

After the following code runs, the values ​​of the four variables a, b, c, and d describe the error is ()

import copy
a = [1, 2, 3, 4, ['a', 'b']]
b = a
c = copy.copy(a)
d = copy.deepcopy(a)
a.append(5)
a[4].append('c')

A. a == [1,2, 3, 4, ['a', 'b', 'c'], 5]
B. b == [1,2, 3, 4, ['a', 'b', 'c'], 5]
C. c == [1,2, 3, 4, ['a', 'b', 'c']]
D. d == [1,2, 3, 4, ['a', 'b', ‘c’]]

Guess you like

Origin www.cnblogs.com/my_captain/p/12729154.html