登录
首页 » 汇编语言 » Python对文件IO操作

Python对文件IO操作

于 2022-03-02 发布 文件大小:2.67 kB
0 316
下载积分: 2 下载次数: 1

代码说明:

filePath="c:/test/tt.txt" #从文件中读取信息 f=open(filePath, "r")#运用读的方式打开文件, for line in f: #每次读取文件的一行内容      print(line) f.close() #向文件中写入信息 f=open(filePath, "a") #这里有两种方式:第一种是以w的形式,它写入时将会清空以前的数据然后再写入数据,第二种是以a的形式,它以追加的形式写入数据 f.write("我开始向文件中写入信息 ") f.writelines("我已经向文件写入了信息") f.close()

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • Multi
    多功能数字钟设计 基本要求: 1.具有时,分,秒的显示。 2.时,分可以调整。 3.使闹钟具有可整点报时与定时闹钟的功能。 -Multi-function digital clock design basic requirements: 1. With hours, minutes and seconds display. 2. Hours, minutes, can be adjusted. 3. To be the whole point timekeeping clock with alarm and timer functions.
    2022-03-19 15:48:22下载
    积分:1
  • 本系统以AT89S52单片机为核心部件,外加温度采集电路、及显示电路和越限报警等电路。采用单总线型数字式的温度传感器DS18B20,使系统具有测温误差小、分辨率...
    本系统以AT89S52单片机为核心部件,外加温度采集电路、及显示电路和越限报警等电路。采用单总线型数字式的温度传感器DS18B20,使系统具有测温误差小、分辨率高、抗干扰能力强,动态显示的方式等特点。本设计既可以对当前温度进行检测又可以对温度进行数码显示,两位整数两位小数的显示方式具有更高的显示精度,若超越极限温度则触发蜂鸣器报警。利用功能强大的Keil和具有互动电路仿真的Proteus进行程序的编写和仿真。-The system AT89S52 microcontroller as its core components, plus the temperature acquisition circuit, and display circuitry, and the more limited alarm circuits. Single bus-type digital temperature sensor DS18B20, the system has a temperature measurement error of the small, high resolution, anti-interference ability, dynamic show the way and so on. This design not only can detect the current temperature can also right temperature digital display, two integers with two decimal places are displayed to show a higher precision, if the temperature is beyond the limits of buzzer alarm is triggered. Keil and the use of powerful interactive circuit simulation of the Proteus programming the preparation and simulation.
    2022-09-14 18:05:02下载
    积分:1
  • 用51单片机实现音乐播放的源代码,能够播放“祝你平安”和“八月桂花香”...
    用51单片机实现音乐播放的源代码,能够播放“祝你平安”和“八月桂花香”-play music by C51
    2022-04-10 17:10:29下载
    积分:1
  • 报警设定时钟
    该项目是数字时钟的使用RTC DS12C887和8051微控制器(AT89C51)与时间设定,我们可以将它设置闹铃唯一不同的改进版本。它有助于理解在RTC的12C887设定报警的概念。该方案采用两个外部中断0和1,分别设定时间和闹铃。用于设置时间销P3中的微控制器8051的^2由低,这是外部中断0。对于报警设置微控制器的引脚P3.3由低是外部中断1。
    2022-02-20 11:32:15下载
    积分:1
  • input student score ,sort and output the result
    输入学生姓名,学号,成绩,成绩可保留一位小数,然后按成绩排序,输出结果-input student score ,sort and output the result
    2022-10-14 11:45:02下载
    积分:1
  • avr串口通信,适合所有型号的,为刚刚入门的人提供参考
    avr串口通信,适合所有型号的,为刚刚入门的人提供参考-avr serial communications, suitable for all models for the entry of people just provide a reference
    2022-12-26 00:20:03下载
    积分:1
  • 用汇编写的win32程序一些例子。
    用汇编写的win32程序一些例子。- With collects the compilation win32 procedure some examples.
    2022-03-10 22:49:21下载
    积分:1
  • 89C52
    基于89C52的实验演示程序,单步运行观看存储单元数据变化, 读和写、发送和接收字节子程序要连续执行。-89C52-based experimental demonstration program, single step change in viewing the data storage unit, read and write, send and receive byte subroutine to consecutive.
    2022-12-23 05:35:02下载
    积分:1
  • 关于用电子时钟的编程设计,对课程设计有重要用处
    关于用电子时钟的编程设计,对课程设计有重要用处-electronic clock on the program design, the design of the curriculum is important useless!
    2023-09-07 12:05:04下载
    积分:1
  • EDIT Assembler can for VC6 VC8 VC2005
    EDIT Assembler can for VC6 VC8 VC2005
    2022-04-07 16:53:19下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载