当前位置:编程学习 > 网站相关 >>

python文本编辑器YAPE(2)

保存功能
使用Textbox的gather()方法得到文本,写到文件中。

import curses
import curses.textpad as tb
 
stdscr = curses.initscr()
 
 
curses.noecho()
editor=tb.Textbox(stdscr)
content=''
try:
    editor.edit()
except KeyboardInterrupt:
    content=editor.gather()
    f=open('./text.txt','w')
    f.write(content)
    f.close()
    curses.endwin()

 \


 \


 

貌似命令行参数那少了一个逗号。。。。。。。。。

 

 

 

无耳卯小孓 无耳卯小摘自  无耳卯小孓 

补充:Web开发 , Python ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,