看板 [ Python ]
討論串[問題] 忘了一個東西
共 6 篇文章
首頁
上一頁
1
2
下一頁
尾頁

推噓1(1推 0噓 1→)留言2則,0人參與, 最新作者huggie (huggie)時間17年前 (2008/01/10 19:50), 編輯資訊
1
0
0
內容預覽:
iterate 一個 list 的時候... a = [1,2,3,4]. 可以用. for i in a:. print a. 也可以用. for i in xrange(len(a)):. print a[i]. 但我忘了那第三個方法是什麼了..最近才發現的... 以前都用第二個方法. 第三個也

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者StubbornLin (Victor)時間17年前 (2008/01/10 20:05), 編輯資訊
2
0
2
內容預覽:
def echo(s):. print s. a = [1,2,3,4]. [echo(item) for item in a]. map(echo, a). 像這樣嗎? 不過print好死不死好像不能當成lambda. --. VICTOR工作室 http://www.kinmen.info/vi

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者StubbornLin (Victor)時間17年前 (2008/01/10 21:18), 編輯資訊
0
0
2
內容預覽:
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就

推噓0(0推 0噓 0→)留言0則,0人參與, 最新作者yungyuc (酷狗喵千代)時間17年前 (2008/01/11 03:46), 編輯資訊
1
0
0
內容預覽:
因為 print 不是 function,是 statement. python3.0 會改了. --. 發信站: 批踢踢實業坊(ptt.cc). ◆ From: 164.107.170.62.

推噓0(0推 0噓 3→)留言3則,0人參與, 最新作者huggie (huggie)時間17年前 (2008/01/14 21:48), 編輯資訊
1
0
0
內容預覽:
你們講的都不是耶..傷腦筋.^^||. 想不起來... --. 發信站: 批踢踢實業坊(ptt.cc). ◆ From: 140.129.160.62.
首頁
上一頁
1
2
下一頁
尾頁