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()

 \


 \


 

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

 

 

 

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

相关内容

    暂无相关文章

评论关闭