繁体   English   中英

Python打印问题

[英]Python printing problems

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM