我有以下格式的输入文件:
457526373620277249 17644162 Sat Apr 19 14:29:22 +0000 2014 0 nc nc U are expressing a wish not a fact ;) @Manicdj99 @ANTIVICTORIA @Nupe117 @cspanwj
457522541926842368 402127017 Sat Apr 19 14:14:09 +0000 2014 0 nc nc @dfwlibrarian You're a great one to call somebody else "educationally challenged!" I'd call that a name call. #YouLose #PJNET #TCOT #TGDNGO YouLose,PJNET,TCOT,TGDNGO
457519476511350786 65713724 Sat Apr 19 14:01:58 +0000 2014 0 nc nc @Manicdj99 @Nupe117 @cspanwj only some RW fringies are upset- & they're ALWAYS angry at something-also too fat 2 get out of lazyboys
我需要根据时间对数据进行排序。
我正在使用strptime
函数,但无法根据时间对整个数据进行排序。在
您希望生成一个行列表,然后对整个列表进行排序;您只捕获时间戳,并且在每次添加新的时间戳时对该列表进行排序,而忽略其余数据。在
您可以使用^{} module 更轻松地读取数据:
假设您的
data.txt
文件如下所示(我将其向右截断了一点):457526373620277249 17644162 2014年4月19日星期六14:29:22+0000 0 457522541926842368 402127017 2014年4月19日星期六14:14:09+0000 0 457519476511350786 65713724 2014年4月19日星期六14:01:58+0000 0
我还假设这里是制表符分隔的。在
这将正确解析数据,将日期作为字符串转换为正确的^{} 对象,然后使用^{} 对这些对象进行排序:
示例:
输出:
^{pr2}$相关问题 更多 >
编程相关推荐