print "I will now count my slaves:"
print "females", 50 + 80 \ 10
print "males", 10 \ 2
print "Is it true that 6 > 7?"
print "What is 59 + 27?"
出于某种原因,它向我显示:
print "females", 50 + 80 \ 10
^
SyntaxError: unexpected character after line continuation character
请您参考如下方法:
\ 字符是行继续字符,而不是除法运算符。它通常用于告诉 Python 将行连接在一起:
foo = "This is a long line that won't fit inside 80 characters " \
"so the line continuation character is one way to extend " \
"the logical line across multiple physical lines."
使用/进行除法:
print "females", 50 + 80 / 10
print "males", 10 / 2
