如何在TCL中打印一些操作的串联
假设有这样的代码:
set val "Hello"
set listA {}
lappend listA 6 7
现在我想输入以下内容:
puts "${val} user! Your list contains two values. First is [lindex $listA 0] and the second is [lindex $listA 1]"
我怎样才能做到这一点?
Say there is a code like this:
set val "Hello"
set listA {}
lappend listA 6 7
Now I want to puts the following:
puts "${val} user! Your list contains two values. First is [lindex $listA 0] and the second is [lindex $listA 1]"
How I can do this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不完全确定我理解是否正确。但是你所做的应该可以工作,只需稍作修改:
给出输出:
I'm not fully sure if I understood correctly. But what you did should work, with a small modification:
Gives the output:
好的,我已经找到答案了。问题在于,在我的实际代码中,我使用“[”和“]”符号作为字符串,但没有“\”。
所以我需要写:
抱歉这个问题。
Ok, I have found the answer. The problem was in the fact that in my actual code I was using "[" and "]" symbols as a string but without "\".
So I need to write:
Sorry for the question.