第一个python实例程序
2016-04-06 00:02
651 查看
#!/usr/bin/python2.7 import os ls = os.linesep fname = raw_input("fname:"); while True: if os.path.exists(fname): print "Error:'%s' already exists" % fname else: break all = [] print "\nEnter lines('.' by itself to quit). \n" while True: entry = raw_input('> ') if entry == '.': break else: all.append(entry) fobj = open(fname, 'w') fobj.writelines(['%s%s' % (x, ls) for x in all]) fobj.close() print 'DONE!'
相关文章推荐
- python __set__ __get__ 等解释
- Python爬虫:济南住宅与房地产信息网
- Python 虚拟环境:Virtualenv
- Creating caffe net prototxt files in python!
- opencv for python学习二之打开视频文件
- numpy 安装
- 安装ipython时python setup.py egg_info错误的解决办法
- Python序列之字符串
- 【python】numpy,scipy,pandas资源列表
- 我的python书写约定
- 推荐 10 款最好的 Python IDE
- 推荐 10 款最好的 Python IDE
- python
- [搬砖]Pycharm中启动IPython notebook失败提示load_entry_point ImportError: Entry point ('console_scripts', 'ipython') not found的解决方法
- 每天一篇python: json对象操作
- Python图片验证码
- Windows 下 Python 环境搭建
- Python 环境搭建
- python小技巧及速度提高
- Python Twisted架构英文版