[問題] 超新手問題, print不了直排的string

看板Python作者 (虎虎)時間8年前 (2017/10/23 16:47), 編輯推噓1(103)
留言4則, 2人參與, 8年前最新討論串1/2 (看更多)
請問各位大神,我最近是用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

10/23 16:51, 8年前 , 1F

10/23 16:52, 8年前 , 2F
separated by sep and followed by end
10/23 16:52, 2F

10/23 20:50, 8年前 , 3F
python print 預設引數end='\n',自己設定end=''就可以囉!
10/23 20:50, 3F

10/23 20:53, 8年前 , 4F
print('*',end='')不熟的函式建議先查官方文件(1F有連結)
10/23 20:53, 4F
文章代碼(AID): #1PxQoXJd (Python)
文章代碼(AID): #1PxQoXJd (Python)