<html>
<body>
<blockquote type=cite class=cite cite="">If you intend to make a text
editor (something which allows the user to browse<br>
through the text and manipulate it at will) using just raw_input and
print, I<br>
think you've set yourself an impossible task. For a console editor you
should<br>
probably look at curses
(<a href="http://www.amk.ca/python/howto/curses/" eudora="autourl">http://www.amk.ca/python/howto/curses/</a>)
- which don't<br>
work on Windows, so you'll probably need this:<br>
<a href="http://adamv.com/dev/python/curses/" eudora="autourl">http://adamv.com/dev/python/curses/</a>
(but according to the site it's incomplete).</blockquote><br>
Ok.<br><br>
<blockquote type=cite class=cite cite="">lines = []<br>
while True:<br>
lines.append(raw_input(''))<br><br>
(But that offers no way to e.g. save and continue.)</blockquote><br>
Ok again.<br><br>
<blockquote type=cite class=cite cite="">Text editors are IMO not applications suitable for learning vanilla Python, or<br>
OOP for that matter. Text editors are used as example applications in the RAD<br>
IDE world (VB, Delphi and such) because in those environments a text editor is<br>
literally three clicks away (click on memo component, click on form, click on<br>
run). Vanilla Python has no GUI, so no memo component - hence my recommendation<br>
for Tkinter or wxPython. PythonCard and Boa provide an experience somewhat<br>
similar to commercial RAD IDE's if that's what you're looking for.</blockquote><br>
I got my idea from looking at Nano, Vi, Joe and a few other UNIX text editors. Nano and Joe are console programs. That's why I thought I would try a console ed. in Python.<br><br>
<br>
<blockquote type=cite class=cite cite="">Having one function for each line is a bad idea whether you code it by hand or<br>
automatically</blockquote><br>
Ah.<br><br>
<blockquote type=cite class=cite cite="">A function implements certain behavior. Having the same behavior (raw_input)<br>
implemented separately for each line is an extremely wasteful way of<br>
programming.</blockquote><br>
Is there a way of telling Python to make a new line after you press Enter (return)?<br><br>
<blockquote type=cite class=cite cite="">I would suggest that you learn a bit more about Python's facilities before<br>
embarking on an ambitious project :) - you won't get very far without knowing<br>
how to use lists and dictionaries.</blockquote><br>
So that's one of the ways Dicts, and lists are used for? I never could fully grasp their use.<br><br>
Thanks,<br>
<x-tab> </x-tab>JQ<br><br>
<x-sigsep><p></x-sigsep>
-----------------------------------<br>
Proud to be a true hacker<br>
(You may have a bad impression of the word "hacker". Do some homework,<br>
go to: <a href="http://catb.org/%7Eesr/faqs/hacker-howto.html">http://catb.org/~esr/faqs/hacker-howto.</a><a href="http://catb.org/%7Eesr/faqs/hacker-howto.html">html</a> and become enlightened) </body>
</html>