文件积木块区

1. 积木功能说明

- 功能简介:打开一个文件用于读写。
- 参数说明:
- 参数1:选择文件的读写模式;有追加模式,覆盖模式和只读模式。
- 追加模式:如果文件存在,文件执政将会放在文件的结尾,新的内容将会写入到文件的结尾,如果文件不存在则创建一个新文件用于读写;
- 覆盖模式:如果文件存在则打开文件,将原有内容删除,从头开始编辑,如果文件不存在,创建新文件用于读写;
- 只读模式:该模式下文件不可以被修改;
- 参数2:输入文件路径。
- 返回值:返回文件对象。


- 功能简介:在文件中写入字符;特殊字符需要用反斜杠\进行转义,如换行为\n,横向制表符(tab键)为\t。
- 参数说明:
- 参数1:输入操作的文件对象;
- 参数2:输入要写入的字符;
- 返回值:无。

- 功能简介:从文件对象中读取字节;
- 参数说明:
- 参数1:输入文件对象;
- 参数2:输入读取字节的个数;输入负数默认为读取全部;
- 返回值:返回读取的字节。

- 功能简介:从文件对象中读取整行;
- 参数说明:
- 返回值:返回读取的整行。

- 功能简介:获取文件指针当前位置;
- 参数说明:
- 返回值:返回文件指针的位置。

- 功能简介:移动文件指针到指定位置;
- 参数说明:
- 参数1:输入文件对象;
- 参数2:选择文件指针开始偏移的位置;
- 参数3:文件指针向后偏移的字节数;
- 返回值:无。

- 功能简介:将指定路径的文件删除;
- 参数说明:
- 返回值:无。

- 功能简介:执行python文件;
- 参数说明:
- 返回值:返回python文件的输出信息,包括print,错误信息等。

- 功能简介:读取CSV表格内容;
- 参数说明:
- 返回值:返回二位列表。

- 功能简介:将二维列表数据写入CSV文件;
- 参数说明:
- 参数1:输入二维列表;
- 参数2:输入CSV文件保存的路径;
- 返回值:无。

- 功能简介:返回目录下文件的列表;
- 参数说明:
- 返回值:返回目录下文件的列表。
2. 注意事项
3. 积木块应用案例
(图1)索引测试案例