Python Intro - System Input and Output
来源:互联网 发布:mui.min.js 编辑:程序博客网 时间:2024/05/16 23:02
#!/usr/bin/python
import sys
file_text = ''
file_finish = 'file_finish'
file_name = raw_input("Enter filename: ")
try:
# open file stream
file = open(file_name, "w")
except IOError:
print "There was an error writing to", file_name
sys.exit()
print "Enter '", "file_finish",
print "' When finished"
while file_text != file_finish:
file_text = raw_input("Enter text: ")
if file_text == file_finish:
# close the file
file.close
break
file.write(file_text)
file.write("\n")
file.close()
file_name = raw_input("Enter filename: ")
if len(file_name) == 0:
print "Next time please enter something"
sys.exit()
try:
file = open(file_name, "r")
except IOError:
print "There was an error reading file"
sys.exit()
file_text = file.read()
file.close()
print file_text
- Python Intro - System Input and Output
- Python input and output
- [Python]Input/Output and str Formatting
- The Python Tutorial - Input and Output
- Input/output system
- 《modern operating system》 chapter 5 Input and output 笔记
- input and output
- itk input and output
- Input and Output
- 7. Input and Output
- 8 Input and Output
- The Python Tutorial 7——Input and Output
- Python 3.3 Tutorial Notes - 5:Input and Output
- [译]The Python Tutorial#7. Input and Output
- Python--Input Output,Unicode
- Input and output of iostream.
- Ch.7 - Input and Output
- Hadoop Streaming Input and Output
- HDU 4565 So Easy!(构造共轭式+矩阵)(好题)
- ios推荐博客
- 初创企业Storytelling之S.M.A.R.T模型五宗”最”
- FrameLayout 学习
- Android TextView显示中文不对齐问题
- Python Intro - System Input and Output
- 在Spring、Hibernate中使用Ehcache缓存
- mysql创建表的时候指定数据类型 括号里面数字代表的含义
- MATLAB提示:‘尝试将script XXX.m作为函数执行’解决方法
- PHP基础之解析json数据
- iOS利用Runtime自定义控制器POP手势动画
- #define GPBCON (*(volatile unsigned *)0x56000010) 的理解
- oVirt-Glusterfs-features
- ScrollView嵌套ListView listview获取焦点把ScrollView顶上去的解决办法