BotVS开发基础—2.5 状态信息显示表格

代码

import json
def main():
    #part 1
    bol     = True
    num     = 10;           # 
    str     = "ABC";        # 字符串
    list    = [1, 2, 3, 4, 5];                          # 列表,方括号
    tuple   = ('physics', 'chemistry', 1997, 2000);     # 元组,小括号,内容不可修改!
    dict    = {'name': "tom", 'age': 14};               #字典
    
    Log(type(bol));
    Log(type(num));
    Log(type(str));
    Log(type(list));
    Log(type(tuple));
    Log(type(dict));
    LogStatus("状态栏显示文本!
 第二行文本 
", num, str, list, tuple, dict);   # 在状态栏里面把以上变量当做参数传入。
    #part 2
    table = {
      'type': 'table',          # 类型。
      'title': '持仓信息',      # 表格标题
      'cols': ['列1', '列2'],   # 表格表头
      'rows': [                 # 表格单元格
                ['abc', 'def'], 
                ['ABC', 'support color #ff0000']
              ]   
            };
    LogStatus('`' + json.dumps(table) + '`');  # table 序列化,前后再加字符`。 
  
    #part 3
    table2 = {                  # 第二个表格
        'type': 'table',
        'title': '第二个表格',
        'cols': ['cols1', 'cols2', 'cols3'],
        'rows': [ ['1', '2', '3'], ['A', "B#FF5634", 'C'], ['', '', '']]
    };
    LogStatus('`' + json.dumps([table, table2]) + '`');  # 两个表格
    

返回

原文地址:https://www.cnblogs.com/bitquant/p/7209776.html