1
dbow May 30, 2014 s = (('a',), ('b',), ('c',), ('d',), ('e',), ('f',))
到 'a','b','c','d','e','f' 这样: ",".join(["'%s'" % x[0] for x in s]) |
2
manfay May 31, 2014 (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 May 31, 2014
直接一条SQL语句查出来算了。。多优雅
|
5
mckelvin May 31, 2014 via Android
|