TCL自學筆記-10創建文件及寫入文件

clear

*clearmarkall

*createmark comps 1 all

set comps_id [hm_getmark comps 1]

set file_ID [open "C:\\example.csv" w]

foreach comp_id $comps_id {

set name [hm_getvalue comps id = $comp_id dataname = name]

puts $file_ID "$comp_id $name"

}

close $file_ID

注意下一步思考id號和部件名能否以csv中兩列文件內容記錄及展示。

clear

*clearmarkall

*createmark comps 1 all

set comps_id [hm_getmark comps 1]

set file_ID [open "C:\\example.csv" w]

foreach comp_id $comps_id {

set name [hm_getvalue comps id = $comp_id dataname = name]

puts $file_ID "$comp_id,$name"

}

close $file_ID

登錄后免費查看全文
立即登錄
App下載
技術鄰APP
工程師必備
  • 項目客服
  • 培訓客服
  • 平臺客服

TOP

1