问题
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)]
This is giving me the error below:
list element in braces followed by ")" instead of space
What could be the issue?
Thanks in advance.
回答1:
You might need to review the basics of Tcl syntax
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.
来源:https://stackoverflow.com/questions/62128382/llength-not-returning-correct-list-size