说明 Python SDK的安装和操作,请参见Python SDK

ListTable代码示例如下:

import time

import logging

import unittest

from tablestore import *

ENDPOINT = “https://xxx.cn-hangzhou.ots.aliyuncs.com“;

ACCESSID = “xxx”;

ACCESSKEY = “xxx”;

INSTANCENAME = “xxx”;

ots_client = OTSClient(ENDPOINT, ACCESSID, ACCESSKEY, INSTANCENAME)

list_response = ots_client.list_table()

print u’instance table:’

for table_name in list_response:

    print table_name        

Python SDK文档的代码示例中没有引入tablestore包的提示,如果未引入tablestore包,则会出现如下提示,请引入tablestore包后运行即可。

Traceback (most recent call last):

  File “listtable.py”, line 6, in

    ots_client = OTSClient(ENDPOINT, ACCESSID, ACCESSKEY, INSTANCENAME)

NameError: name ‘OTSClient’ is not defined