看板 Python 關於我們 聯絡資訊
請問各位大神,我最近是用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 * * * * * <built-in function print> * * * * * <built-in function print> * * * * * <built-in function print> -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 1.160.92.113 ※ 文章網址: https://www.ptt.cc/bbs/Python/M.1508748449.A.4E7.html
djshen: separated by sep and followed by end 10/23 16:52
ddchris: python print 預設引數end='\n',自己設定end=''就可以囉! 10/23 20:50
ddchris: print('*',end='')不熟的函式建議先查官方文件(1F有連結) 10/23 20:53