+ 运算符在这一行中做什么?
What does + operator do in this line?
我正在尝试修改现有模块中的方法以适应功能。
+ 运算符在这一行中做什么?
for line in payment.move_line_ids + expense_sheet.account_move_id.line_ids:
你好M.E.,
解决方案
- 使用的运算符是 concatenation/combine 两个
List/String/Tupple
。
例子
Plus(+) 运算符与两个 List
一起使用
a = [1,2,3]
b = [4,5]
print a + b
output = [1,2,3,4,5]
+
运算符与两个 String
一起使用
a = "Vora"
b = " mayur"
print a + b
output = "vora mayur"
+
运算符与两个元组一起使用
a = (1,2,3)
b = (4,5)
print a + b
output = (1,2,3,4,5)
它concatenates account.move.line
records from payment.move_line_ids
and expense_sheet.account_move_id.line_ids
into a single recordset, which is then iterated over. Please note that the result of the __add__
(+) operation might contain duplicates if the same account.move.line
is present in both operands. If you want to avoid duplicates, use the |
(OR) operator.
我正在尝试修改现有模块中的方法以适应功能。 + 运算符在这一行中做什么?
for line in payment.move_line_ids + expense_sheet.account_move_id.line_ids:
你好M.E.,
解决方案
- 使用的运算符是 concatenation/combine 两个
List/String/Tupple
。
例子
Plus(+) 运算符与两个
一起使用List
a = [1,2,3]
b = [4,5]
print a + b
output = [1,2,3,4,5]
一起使用+
运算符与两个String
a = "Vora"
b = " mayur"
print a + b
output = "vora mayur"+
运算符与两个元组一起使用a = (1,2,3)
b = (4,5)
print a + b
output = (1,2,3,4,5)
它concatenates account.move.line
records from payment.move_line_ids
and expense_sheet.account_move_id.line_ids
into a single recordset, which is then iterated over. Please note that the result of the __add__
(+) operation might contain duplicates if the same account.move.line
is present in both operands. If you want to avoid duplicates, use the |
(OR) operator.