使用Python编辑文本文件。 [英] edit a text file with Python.

查看:52
本文介绍了使用Python编辑文本文件。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在学习Python,我需要一些帮助。我有一个12列填充数字的文本文件。我需要编写一个能够选择列并将该列中的所有值清零的脚本。我不需要担心抓取文件或保存它,因为我正在使用一个extrnal程序来完成所有这些。我只需要帮助那部分零'otu指定列。

I''m learning Python and I need some help. I have a text file with 12 columns filled with numbers. I need to write a script that would be able to select a column and zero out all the values in that column. I don''t need to worry about grabbing the file or saving it because I''m useing an extrnal program to do all of that. I just need help with that part that zero''s otu the specified column.

推荐答案

该文本文件在单独行中的列之前有一些文本。
also that text file has a some text before the columns in separate line.



我正在学习Python,我需要一些帮助。我有一个12列填充数字的文本文件。我需要编写一个能够选择列并将该列中的所有值清零的脚本。我不需要担心抓取文件或保存它,因为我正在使用一个extrnal程序来完成所有这些。我只需要帮助那个零'otu指定列的部分。
I''m learning Python and I need some help. I have a text file with 12 columns filled with numbers. I need to write a script that would be able to select a column and zero out all the values in that column. I don''t need to worry about grabbing the file or saving it because I''m useing an extrnal program to do all of that. I just need help with that part that zero''s otu the specified column.



你的外部程序会给你什么回报?列表,字典,集合,字符串?如果是字典:

What does your external program return to you? A list, dictionary, set, string? If it is a dictionary:

展开 | 选择 | Wrap | 行号



我正在学习Python,我需要一些帮助。我有一个12列填充数字的文本文件。我需要编写一个能够选择列并将该列中的所有值清零的脚本。我不需要担心抓取文件或保存它,因为我正在使用一个extrnal程序来完成所有这些。我只需要帮助那个零'otu指定列的部分。
I''m learning Python and I need some help. I have a text file with 12 columns filled with numbers. I need to write a script that would be able to select a column and zero out all the values in that column. I don''t need to worry about grabbing the file or saving it because I''m useing an extrnal program to do all of that. I just need help with that part that zero''s otu the specified column.



为什么你不显示样本输入文件,你想要的样本输出文件?

why don''t you show a sample input file, a sample output file that you want?


这篇关于使用Python编辑文本文件。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆