【发布时间】:2017-12-15 14:13:50
【问题描述】:
我需要修改一个文件,其中包含几行不匹配的大括号,例如:
rmsd {
atoms {
atomsFile
atomsCol B
atomsColValue 1
}
如果我这样做:
set fp [open "fpor.conf" r]
set file_data [read $fp]
close $fp
set confFile [split $file_data "\n"]
set inOut [open "us.in" w]
foreach line $inFile {
if {[lindex $line 0] == "atomsFile"} {
lappend line "us.pdb"
}
puts $inOut "$line"
}
close $inOut
脚本失败并出现以下错误: 列表中不匹配的左大括号。有没有办法避免这种情况?
【问题讨论】:
标签: file tcl curly-braces