InitialSearch='Searched data'
file = open("textfile.txt","r")
lines = file.readlines()
file.close()
fileOutput = open ('NewTextFile.txt', 'w')
for x,line in enumerate(lines):
if line.find(InitialSearch)>=0:
fileOutput.write(line)
fileOutput.close
代码无法正常工作
答案 0 :(得分:0)
for循环中已经有“ matched”行的fun foo() {
viewModelScope.launch {
messageRepo.getMessages().map { message ->
viewModelScope.async(Dispatchers.IO) {
doHardWork(message)
}
}.awaitAll()
withContext(Dispatchers.Main) {
// here I need some callback that all work is done.
}
}
}
。只需在其中添加两个,就可以将要添加到输出文件的行显示出来。
index