关于Python字符串操作的描述,错误的是
A: >>> "hellohellohello"/3
输出结果是"hello"
B: >>> "hello"*2
输出结构是'hellohello'
C: >>> 'hello' + 1
输出结果是
Traceback
(most recent call last):
File
"", line 1, in
"hello"
+ 1
TypeError:
must be str, not int
D: >>> "hello" - "world"
输出结果是
Traceback
(most recent call last):
File
"", line 1, in
"hello"
- "world"
TypeError:
unsupported operand type(s) for -: 'str' and 'str'
A: >>> "hellohellohello"/3
输出结果是"hello"
B: >>> "hello"*2
输出结构是'hellohello'
C: >>> 'hello' + 1
输出结果是
Traceback
(most recent call last):
File
"", line 1, in
"hello"
+ 1
TypeError:
must be str, not int
D: >>> "hello" - "world"
输出结果是
Traceback
(most recent call last):
File
"", line 1, in
"hello"
- "world"
TypeError:
unsupported operand type(s) for -: 'str' and 'str'
举一反三
- 关于变量的描述,下面选项中描述正确的是 A: 变量在使用前可以不赋值即使用 B: 1_1可以作为一个变量名 C: is可以作为一个变量名 D: 以下代码中,a是一个变量,但执行a<br/>+''34"会出错,错误类型为TypeError:<br/>unsupported operand type(s) for +: 'int' and 'str'<br/>>>><br/>a = 12<br/>>>><br/>a + "34"<br/>a = 12<br/>>>><br/>a + "34"
- 以下选项中,输出结果为False的是()。 A: >>><br/>'python123' > 'python' B: >>><br/>'ABCD' == 'abcd'.upper() C: >>><br/>'' D: >>><br/>'python'
- 以下选项中,输出结果为False的是() A: >>><br/>'python123' > 'python' B: >>><br/>'python' < 'pypi' C: >>><br/>'''' >><br/>'ABCD' == 'abcd'.upper()
- 关于变量的描述,下面选项中描述正确的是 A: 变量在使用前可以不赋值即使用 B: 1_1可以作为一个变量名 C: is可以作为一个变量名 D: 以下代码中,a是一个变量,但执行a<br/>+''34"会出错,错误类型为TypeError:<br/>unsupported operand type(s) for +: 'int' and 'str'<br/>>>><br/>a = 12<br/>>>><br/>a + "34"
- 关于变量的描述,下面选项正确的是 A: 变量在使用前可以不赋值即使用 B: 1_1可以作为一个变量名 C: is 可以作为一个变量名 D: >>><br/>a = 12<br/>>>> a + "34"<br/>a 是一个变量,但执行a<br/>+''34" 会出错,错误类型为TypeError:<br/>unsupported operand type(s) for +: 'int' and 'str'