基本上我有一堆包含域名的文件.我使用.sort(key = func_that_returns_tld)根据TLD对每个文件进行了排序
既然我已经完成了我想要合并所有文件并最终得到一个大规模的排序文件.我想我需要这样的东西:
open all files
read one line from each file into a list
sort list with .sort(key=func_that_returns_tld)
output that list to file
loop by reading next line
Run Code Online (Sandbox Code Playgroud)
我在考虑这个问题吗?任何关于如何实现这一点的建议将不胜感激.
我想在python中这样做,但我很难过.我不能将整个文件加载到ram而不会变得不稳定,所以我想逐行阅读...任何建议将不胜感激.