我想使用迭代器创建一个列表,该列表将达到 100,000
['guid:0','guid:2',......'guid:100000']
Python是最Python的方法来做到这一点吗?一个单线...
如何使用 Python 在 Cassandra 中创建键空间?
from cassandra.cluster import Cluster
cluster = Cluster(['cassandra.sucks.com'])
session = cluster.connect()
session.execute('CREATE KEYSPACE IF NOT EXISTS kong')
File "cassandra/cluster.py", line 1998, in cassandra.cluster.Session.execute (cassandra/cluster.c:34869)
File "cassandra/cluster.py", line 3781, in cassandra.cluster.ResponseFuture.result (cassandra/cluster.c:73073)
cassandra.protocol.SyntaxException: <Error from server: code=2000 [Syntax error in CQL query] message="line 0:-1 mismatched input '<EOF>' expecting K_WITH">
Run Code Online (Sandbox Code Playgroud) 我使用厨师,但我是一名python开发人员.我需要拆分一个看起来像这样的字符串:
ms = "a-b-c-d"
Run Code Online (Sandbox Code Playgroud)
然后我需要获得第三个元素'c'
在python我会这样做:
ms.split('-')[2]
Run Code Online (Sandbox Code Playgroud)
做红宝石的方式是什么?
在python我可以time.time()用来得到这个:
time = time.time()
time = 1362914221
Run Code Online (Sandbox Code Playgroud)
我如何在java脚本中得到它?
time = ????
Run Code Online (Sandbox Code Playgroud)