1
dbow 2014-05-30 23:34:47 +08:00 3
s = (('a',), ('b',), ('c',), ('d',), ('e',), ('f',))
到 'a','b','c','d','e','f' 这样: ",".join(["'%s'" % x[0] for x in s]) |
2
manfay 2014-05-31 00:00:27 +08:00 1
(item[0] for item in Tuple)
|
3
napoleonu OP @dbow 非常感谢。(('a',1), ('b',2), ('c',3), ('d',4), ('e',5), ('f',6))是一样的,比我优雅的多的拼接字符串,哈。
我这到了这个,不再拼接字符串: >>> a=(('a',1), ('b',2), ('c',3), ('d',4), ('e',5), ('f',6)) >>> id,name = zip(*a) >>> print str(id); ('a', 'b', 'c', 'd', 'e', 'f') >>> print str(name); (1, 2, 3, 4, 5, 6) |
4
skydiver 2014-05-31 02:23:58 +08:00
直接一条SQL语句查出来算了。。多优雅
|
5
mckelvin 2014-05-31 10:29:30 +08:00 via Android
|