llength 没有返回正确的列表大小 [英] llength not returning correct list size

查看:32
本文介绍了llength 没有返回正确的列表大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含以下元素的列表.

I have a list which has the elements below.

test = {a[1] b[60] c[25] c[36]}

我正在检查测试的长度如下:

I am checking the length of test as below:

set result [llength ($test)]

这给了我以下错误:

list element in braces followed by ")" instead of space

可能是什么问题?

提前致谢.

推荐答案

您可能需要复习 Tcl 语法

不要在 llength 的参数周围加上括号.

Don't put parenthesis around the argument to llength.

set x {test = {a[1] b[60] c[25] c[36]}}
set result [llength $x]

在以后的问题中,最好发布一个完整的程序,可以执行,以便您的错误可以轻松重现.

In future questions, it is better to post an entire program that can be executed so that your error can be reproduced easily.

这篇关于llength 没有返回正确的列表大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆