1
raquelken 2012-09-21 15:59:04 +08:00 1
".".join([str(id) for id in d])
|
2
wong2 2012-09-21 16:02:42 +08:00 1
map(str, d)
|
5
raquelken 2012-09-21 16:14:32 +08:00
列表推导,可以看看这里 http://www.python.org/dev/peps/pep-0202/
|
6
Alpha OP 综合两位的回答,我发现这样才正确,谢谢
def f(): return str(random.randrange(1,255,1)) '.'.join([f() fro i in range(4)]) python的确可以省好多功夫 |