好了,希望我的解释您的格式在正确的道路......
可以说,它是这样的:
约翰·史密斯/新York/[email protected]/ 0175113322
斯蒂芬·金/新York/[email protected]/0157331122
TCL的片段阅读此信息到一个列表会看升IKE在此:
## Read the data from file
set fp [open "test.txt" r]
set file_data [read $fp]
close $fp
## process the data
set data [split $file_data "\n"]
set contact_list {}
foreach line $data {
lappend contact_list [split $line "/"]
}
## Read out the information from the list
puts $contact_list
puts [lindex $contact_list 0]
puts [lindex [lindex $contact_list 1] 3]
要超过搜索列表中只使用lsearch就可以了...
欢迎计算器。如果您尝试过某些功能并被困在特定的位置,请发布您的相关代码。如果您只是要求某人为您编写一些代码,那不是StackOverFlow的工作原理。请参阅http://stackoverflow.com/questions/how-to-ask – jac
此外,您需要在输入文件中显示几行,以便我们知道确切的格式。 –
问这样的好问题会帮助你获得帮助你的答案(以及其他人)。 –