所以我有一个文本文件,我需要按字母顺序排序.输入示例:
This is the first sentence
A sentence here as well
But how do I reorder them?
Run Code Online (Sandbox Code Playgroud)
输出:
A sentence here as well
But how do I reorder them?
This is the first sentence
Run Code Online (Sandbox Code Playgroud)
事情就是这样:这个文件太大了,我没有足够的RAM来实际将它分成列表/数组.我试图使用Python的内置sorted()函数,并且该进程被杀死.
给你一个想法:
wc -l data
21788172 data
Run Code Online (Sandbox Code Playgroud)