作者IMPOSSIBLEr (I'm possible rrr)
看板Python
标题Re: [问题] 超新手问题, print不了直排的string
时间Tue Oct 24 12:33:43 2017
※ 引述《tiger66 (虎虎)》之铭言:
: 请问各位大神,我最近是用2x版本的书在学习,
: 用的是3.x的版本。
: 这个问题我试了非常多次搞不懂,才上来问。
: 我想要出现的结果是
: *****
: *****
: *****
: 但是一直呈现下面这样,而且还出现built-in function print,
: 请问要怎麽去掉呢?谢谢。
: numlines = int(input('how many lines do you want?'))3
: numstars = int(input('how many stars do you want?'))5
: for line in range (0, numlines):
: for star in range(0, numstars):
: print('*',)
: print
for line in range(numlines):
print(“*” * numstars)
The reason for the last <built-in function print>
Was because you called “print” without (),
which is a function itself.
Then you need to remember that print function
automatically appends a newline for you.
Good luck~~
: *
: *
: *
: *
: *
: <built-in function print>
: *
: *
: *
: *
: *
: *
: <built-in function print>
: *
: *
: *
: *
: *
: <built-in function print>
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 67.160.193.120
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1508819627.A.4CB.html