Re: [問題] 忘了一個東西

看板Python作者 (Victor)時間17年前 (2008/01/10 21:18), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串3/6 (看更多)
※ 引述《StubbornLin (Victor)》之銘言: : ※ 引述《huggie (huggie)》之銘言: : def echo(s): : print s : a = [1,2,3,4] : [echo(item) for item in a] : map(echo, a) : 像這樣嗎? 不過print好死不死好像不能當成lambda from sys import stdout a = [1,2,3,4] # method 1 [stdout.write(item) for item in a] # method 2 map(stdout.write, a) 改了一下,不用print改用直拿stdout來write就可以了 -- VICTOR工作室 http://www.kinmen.info/vic/ 程式設計教學 http://victorlin.serveftp.org/programming/ -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 125.231.218.77
文章代碼(AID): #17XXirkH (Python)
文章代碼(AID): #17XXirkH (Python)