当我尝试运行此代码时,为什么会出现语法错误?

选择 | 换行 | 行号
  1. x=3
  2. title = "PHP Programing"
  3. author = "LERDORF"
  4. publisher = "oreily"
  5. major = "cent"
  6. outfile = open("book.html","w")
  7. outfile.write ('<html>\n')
  8. outfile.write ('     <body>\n')
  9. while ( x > 1 ):
  10.     outfile.write('     <p class= "title">' + title +'</p>\n')
  11.     outfile.write('     <p class= "author">' + author +'</p>\n')
  12.     outfile.write('     <p class= "publisher">' + publisher '</p>\n')
  13.     x = x - 1
  14. outfile.write ('     </body>\n')
  15. outfile.write ('     </body>\n')
  16. outfile.close()
  17.  
# 回答1

我找到了丢失的加号。谢谢斯科特

标签: python

添加新评论