python怎么将txt文件的内容逐行读取转化成数组


本篇内容主要讲解“python怎么将txt文件的内容逐行读取转化成数组”,感兴趣的朋友不妨来看看。本文介绍的方法操作简单快捷,实用性强。下面就让小编来带大家学习“python怎么将txt文件的内容逐行读取转化成数组”吧!例:将train5bottle.names的每行内容提取出来转化成数组转换代码:原srt文件0
00:00:00,150 –> 00:00:11,430
Fighting this pandemic needs political commitment and commitment at the highest level possible and the President’s commitment.1
00:00:11,431 –> 00:00:16,020
you have what it is in it and the would it have seen it.2
00:00:16,021 –> 00:00:19,320
and that kind of 免费云主机域名leadership is very,3
00:00:19,321 –> 00:00:20,160
very important.4
00:00:20,161 –> 00:00:21,570
The whole of government approach.转化之后的数组(将时间和内容分离)[’00:00′, ’00:11′, ’00:16′, ’00:19′, ’00:20′][“Fighting this pandemic needs political commitment and commitment at the highest level possible and the President’s commitment.”, ‘you have what it is in it and the would it have seen it.’, ‘and that kind of leadership is very,’, ‘very important.’, ‘The whole of government approach.’]下面贴出转化的代码,即将cte_test.srt转化成数组之后可以考虑输送到mysql数据库上进行复用到此,相信大家对“python怎么将txt文件的内容逐行读取转化成数组”有了更深的了解,不妨来实际操作一番吧!这里是百云主机网站,更多相关内容可以进入相关频道进行查询,关注我们,继续学习!

相关推荐: PHP curl请求头域的含义与作用是什么

本文小编为大家详细介绍“PHP curl请求头域的含义与作用是什么”,内容详细,步骤清晰,细节处理妥当,希望这篇“PHP curl请求头域的含义与作用是什么”文章能帮助免费云主机域名大家解决疑惑,下面跟着小编的思路慢慢深入,一起来学习新知识吧。 一、HTTP请…

免责声明:本站发布的图片视频文字,以转载和分享为主,文章观点不代表本站立场,本站不承担相关法律责任;如果涉及侵权请联系邮箱:360163164@qq.com举报,并提供相关证据,经查实将立刻删除涉嫌侵权内容。

Like (0)
Donate 微信扫一扫 微信扫一扫
Previous 06/03 11:57
Next 06/03 11:57

相关推荐