保存数据到文件 save data to file python2.6和python3中print用法

我用的是python2.6, 今天在用print命令的时候就发现了和python 3 不同的地方。 如果在python 2 中运用print应该在文件的开头加入:from __future__ import print_function



红色的部分是存储数据到文件, open函数是打开一个文件,第一个参数是文件的名称,第二个参数是读写的模式(r是只读模式;w是只写模式)

打开文件后一定要记得调用close()来关闭文件

man是一个list,用print函数可以把list里面的内容输入到名称为man_file的txt文本内;同样也把other list里面的内容输入到以other_file命名的txt文本里面。

输出完毕后,关闭文件。

会发现原本的chapter 4 文件夹内多出了2个txt文件:



原本fruit文本里面的内容为:



执行完程序之后得到的结果为:

man_file里面的文本内容为:



other_file里面的文本内容为:



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
RAM清理软件htcAddictscleanRAM 1.7 【软件名称】RAM清理软件htcAddictscleanRAM 【软件版本】1.7 【软件类型】系统清理 【支持平台】WM5.0 以上设备 【测试平台】ELFIN 6.5 【软件大小】222K 【发布日期】2009-8-29 【汉化人员】独孤天马 【软件简介】 这是htcAddicts为Windows Mobile 6创建的一个非常有用的释放内存的工具。尽可能不损坏内部状态的情况下更新您的设备内存。可以让你尽量减少设备的软复位! 功能: 3个级别的配置菜单和自定义进程列表。 等级 1 - 基本清理 (快速) 清理无响应任务 等级 2 - 标准清理 最大限度清理.推荐最佳运行状态 等级 3 - 高级清理 (缓慢) 重置无响应任务并清理. 最大化清理 自定义进程列表: 显示运行的进程,选择进程并清理。 定时清理功能。 多想选项设置 排除清理列表 版本历史 Version 1.7 -新功能:清理完成时今日屏幕显示+新的注册表值(LangFolder)帮助你定义默认的语言文件+修正一些错误+语言文件修正。1.7版8月8日更新 Version 1.67 -官方网站没有发现更新,手机上有更新,不清楚更新内容. Version 1.65 -官方网站没有发现更新,手机上有更新,不清楚更新内容,在自定义清理选项上有更改。 Version 1.6 -修正当使用关闭全部程序时语音命令和邮件服务停止+修正确定按钮没有保存列表问题+添加定时特性调试状态+修正备份不能保存语言+cleanRAM现在支持更多程序+修正用户报告的错误+界面一些小的更改+语言文件添加系的字段+语言文件添加至XAB文件 此版依然采用核心汉化。 Version 1.5.5-1.5.9 -这两天每天都在更新,由于官方没有发布,不知道更新什么,手机上有更新。 Version 1.5.5 -修正更新服务小错误+修正自动发现启动文件夹名称 Version 1.5.0 -添加启动启动项程序功能+添加强制关闭全部程序功能+修正定时首次运行的错误 Version 1.4.0 -改进等级1+修正一些错误 Version 1.3.9 -修正几个错误+改进更新服务 Version 1.3.8 -添加检查更新注册表项 Version 1.3.7 - 修正止按钮+添加更新服务+更新语言版本 Version 1.3.6 - 添加并修正休眠模式(切换开/关)+添加-收回最大数的可用内存,建议旧设备使用。+修正tocuhflo3d2短信标签不刷新的问题+语言文件更新 Version 1.3.5 - 修正定时无法启动的问题+时间格式现在支持点(如:hh.mm.ss ) Version 1.3.4 -修正由于使用cleanRAM (等级 1,2,3)后HTC相机相册(touchFLO)无法刷新问题 Version 1.3.3 -添加并修正更多S2U2兼容问题+支持更多的程序+修正几个小错误+语言文件修正(还是用核心汉化) Version 1.3.2 - 修正: 定时模式的错误 + 修正在重启后电话设置关闭的问题 + 修正其他一些错误 Version 1.3.1 - 添加并修正: 修正无法启动关于画面的问题 + 修正等级 3 断开手机信号没有重新连接的问题 + 添加S2U2的兼容性 Version 1.3.0 - 修正:多种错误,增加语言包的支持。 Version 1.1.8 - 添加排除列表! Version 1.1.7 - Fix修正时间表问题 Version 1.1.6 - 修正止按钮终止进程的问题;修正清理最近程序的问题; Version 1.1.5 - 添加软重置功能;添加对 XBmod Manila Rhodium支持;修正自定义进程列表模式问题。 Version 1.1.4 - Added: New "reset timer" button in schedule feature, this button will save the schedule settings and restart the schedule timer / "close" button will save the schedule settings and will not reset the schedule timer Version 1.1.3 - Added & Fixed: Backup/Restore Settings new feature! + some small schedule issue interface fixed Version 1.1.2 - Added & Fixed: CleanUp Programs selection for schedule feature added + schedule small issue interface fixed Version 1.1.1 - Fixed: schedule feature settings saved after soft reset + some schedule issues fixed Version 1.1.0 - Added: new feature! Schedule your cleanRAM (final version) Version 1.0.9.7 - Fixed: CleanRAM doesn't save the custom process list Version 1.0.9.6 - Added: new feature! clear recent start menu items (without soft reset of course) + add new app for level 1 Version 1.0.9.5 - Added: first configuration screen split to new settings screen Version 1.0.9.3 - Fixed: Getting an error when trying to access the "Custom Processes List" Version 1.0.9.2 - Added & Fixed: new windows wait cursor (On/Off) added + small memory issue fixed Version 1.0.9.1 - Added & Fixed: new Progress Bar (On/Off) added + new run cleanRAM from configuration screen ("Clean Now!" button added) + Keyboard bug (after cleanRAM wouldn't let you change keyboards) fixed + Inaccurate RAM status report fixed Version 1.0.9 - Added & Fixed: cumulative bugs (from the first version to now) + interface and code improved + cleaning progress bar added Version 1.0.6 - Fixed: some memory small issue (level 3) + version string not correct + icon duplicated (cleanRAM(1)) Version 1.0.5 - Added: Icons Changed (mmm... i'm not an artist) + NO NEED NET 3.5 INSTALLED (not anymore!) + new icon (exercise application icon) in start menu Version 1.0.4 - Fixed: about screen + small issue (nk.exe error msg) for htc touch pro users Version 1.0.3 - Added: all registry settings is now in the archive/installation file (cab) + new icon for "cleanRAM config" shortcut (red) Version 1.0.2 - Fixed: application shortcuts doesn't appears (on some devices) Version 1.0.1 - Fixed: some small issues with Level 1 Version 1.0.0 - Added: "Reset Processes Mode" new feature with restart time chooser Version 0.9.5 - Added: "Show Hidden Processes" new feature to show all processes (including services. dangeros!) Version 0.9.2 - Fixed: problem with "RAM Status Notification" screen and other small issues 【使用方法】直接复制到PDA,安装和运行。去掉官方语言文件,采用核心汉化。 【特别提示】CAB和绿色 ===========汉化声明============== 本汉化程序不保证能兼容所有的手机硬件和同机安装的任何软件,; 您必须自行担负所有可能因使用本程序而发生的风险 本软件由独孤天马制作汉化,汉化版权属于独孤天马所有。, 如果您要转贴本软件以及图形、文字资料,请注明出处及汉化人员:blog.sina.com.cn/dugutianma汉化人员:独孤天马。 ============感谢您的使用=========== 本软件来自于互联网,版权归原作者所有。如果您感觉侵犯了您的权利,请麻烦通知我及时删除,谢谢!!!

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值