作业帮 > 英语 > 作业

python 我想知道这句的具体含义:this only works with two literals,not wit

来源:学生作业帮 编辑:作业帮 分类:英语作业 时间:2024/07/14 00:14:11
python 我想知道这句的具体含义:this only works with two literals,not with arbitrary string express
什么是arbitrary string expression,什么事literals,有什么区别
Two string literals next to each other are automatically concatenated; the first
line above could also have been written word='Help''A'; this only works with two literals,not with
arbitrary string expressions:
Python Tutorial?
这里的意思是,两个邻接的字符串会被自动拼接在一起.但这一规则不能对任意的字符串表达式起作用.
>>> "help" "a"
'helpa'
>>> "help" "abdfgdsaf".strip()
'helpabdfgdsaf'
>>> "string".strip() "help"
SyntaxError: invalid syntax