Re: symbolic links, aliases, cls clear

2006-04-15 Thread Chris F.A. Johnson
On 2006-04-13, Barry Margolin wrote: > In article <[EMAIL PROTECTED]>, > "Chris F.A. Johnson" <[EMAIL PROTECTED]> wrote: > >> In fact, my scripts are portable to other terminal types by use >> of files for each terminal, generated with tput. Us

Re: symbolic links, aliases, cls clear

2006-04-12 Thread Chris F.A. Johnson
On 2006-04-12, Christos Georgiou wrote: > On Wed, 12 Apr 2006 15:59:05 -0400, rumours say that "Chris F.A. Johnson" ><[EMAIL PROTECTED]> might have written: > >>>>I still have a system which does not have tput. >>> >>> And that justifies

Re: symbolic links, aliases, cls clear

2006-04-12 Thread Chris F.A. Johnson
On 2006-04-12, jpd wrote: > Begin <[EMAIL PROTECTED]> > On 2006-04-12, Chris F.A. Johnson <[EMAIL PROTECTED]> wrote: >>These days, the ISO-6429 standard (almost the same as the older >>ANSI x3.64) is so close to universal that I don't bother writi

Re: symbolic links, aliases, cls clear

2006-04-12 Thread Chris F.A. Johnson
On 2006-04-12, Floyd L. Davidson wrote: > Keith Thompson <[EMAIL PROTECTED]> wrote: >>>tput clear >> >>(Or "clear".) > > But /clear/ merely uses "tput clear". Not on systems without tput. -- Chris F.A. Johnson, author |

Re: symbolic links, aliases, cls clear

2006-04-12 Thread Chris F.A. Johnson
from the start. > Instead the proper sequence should be obtained from the > appropriate database (TERMINFO or TERMCAP), and the easy way to > do that is, > > tput clear I still have a system which does not have tput. -- Chris F.A. Johnson, author |<http://cfaj.f

Re: symbolic links, aliases, cls clear

2006-03-29 Thread Chris F.A. Johnson
a symbolic link? if so, where should i place it? > > what is the difference between aliases and symbolic links? What's the difference between a raven and a writing desk? > if i execute a command like 'clear' to clear the screen, where does the > shell look to find

Re: Spelling mistakes!

2006-01-08 Thread Chris F.A. Johnson
On 2006-01-08, Robin Becker wrote: > Chris F.A. Johnson wrote: >> On 2006-01-08, Terry Hancock wrote: >> >>>BTW, one of the most common programming spelling errors is >>>"deprecate" versus "depreciate" -- I wonder how many people >>

Re: Spelling mistakes!

2006-01-08 Thread Chris F.A. Johnson
verlap in meaning. Both can mean to disparage or belittle. Some dictionaries give 'depreciate' as a definition of 'deprecate'. -- Chris F.A. Johnson, author |<http://cfaj.freeshell.org> Shell Scripting Recipes: | My code in this post, if any,

Re: reading files into dicts

2005-12-29 Thread Chris F.A. Johnson
On 2005-12-30, Tim Williams (gmail) wrote: > Apologies for the top post, it was my first attempt at using gmail's > pda-enabled web interface. There is no option to bottom post. Can you not move the cursor? -- Chris F.A. Johnson, author |<http://cfaj.freeshell

Re: i=2; lst=[i**=2 while i<1000]

2005-12-06 Thread Chris F.A. Johnson
while' in a list comprehension which would >>>terminate? >> >> >> unless I am missing something obvious, I can not see why the loop should >> not terminate > > In that case, kindly explain how the condition i<1000 can become false > when it st

Re: wxPython Licence vs GPL

2005-11-26 Thread Chris F.A. Johnson
copyright to give you a different license. -- Chris F.A. Johnson, author |<http://cfaj.freeshell.org> Shell Scripting Recipes: | My code in this post, if any, A Problem-Solution Approach | is released under the 2005, Apress | GN

Re: os.popen('alias')

2005-11-18 Thread Chris F.A. Johnson
On 2005-11-19, Chris F.A. Johnson wrote: > On 2005-11-18, Belebele wrote: >>>From an interactive python shell, I execute the following: >> >> import os >> for line in os.popen('alias').readlines(): >>

Re: os.popen('alias')

2005-11-18 Thread Chris F.A. Johnson
s defined in the shell from where > I started python? Store them in a file before calling python, and read that file. -- Chris F.A. Johnson, author |<http://cfaj.freeshell.org> Shell Scripting Recipes: | My code in this post, if any, A Problem-Soluti

Re: Goto XY

2005-11-08 Thread Chris F.A. Johnson
On 2005-11-09, Grant Edwards wrote: > On 2005-11-09, Chris F.A. Johnson <[EMAIL PROTECTED]> wrote: >> >>> Is there some command in python so that I can read a key's input and >>> then use a gotoxy() function to move the cursor on screen? e.g.: >>> (

Re: Goto XY

2005-11-08 Thread Chris F.A. Johnson
On 2005-11-09, Jean-Paul Calderone wrote: > On Tue, 8 Nov 2005 22:33:47 -0500, "Chris F.A. Johnson" <[EMAIL PROTECTED]> > wrote: >> [snip] >> >> To read a single keystroke, see Claudio Grondi's post in the >> thread "python without O

Re: Goto XY

2005-11-08 Thread Chris F.A. Johnson
single character, so more work is required to decode them. The principle is outlined in <http://www.unixreview.com/documents/s=9920/ur0511a/ur0511a.html>; the code there is for the shell, but translating them to python should be straightforward. I'll probably do it m

Re: Getting Python Accepted in my Organisation

2005-11-05 Thread Chris F.A. Johnson
On 2005-11-05, Steven D'Aprano wrote: > On Fri, 04 Nov 2005 20:55:48 -0500, Chris F.A. Johnson wrote: > > > > So that people reading your reply know what you are commenting about. > > (Now, imagine that you're reading from a newsgroup where Chris' post has >

Re: Getting Python Accepted in my Organisation

2005-11-04 Thread Chris F.A. Johnson
ay the quoted material (actually it displays the first line of each block). Or I press TAB to jump to the next original material. > I would only do in-line response type when there is a need for > specific response in context. If there's not, why would you quote anything? --

Re: Windows vs Linux [was: p2exe using wine/cxoffice]

2005-10-26 Thread Chris F.A. Johnson
not at work where I > have no choice!) In my ~/.inputrc: "\e[a": history-search-backward ## shift+up-arrow "\e[b": history-search-forward ## shift+down-arrow -- Chris F.A. Johnson <http://cfaj.freeshell.org> =

Re: An interesting question about "print '\a'"

2005-10-23 Thread Chris F.A. Johnson
int '\a' > > on my local machine. > > Does the command get sent back to the client machine? The code is printed to stdout, which is your terminal. Your terminal interprets ^G as a beep. -- Chris F.A. Johnson <http://cfaj.freeshell.org> ==

Re: best way to replace first word in string?

2005-10-22 Thread Chris F.A. Johnson
On 2005-10-22, William Park wrote: > Chris F.A. Johnson <[EMAIL PROTECTED]> wrote: >> On 2005-10-22, William Park wrote: >> > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> >> I am looking for the best and efficient way to replace the first word >

Re: best way to replace first word in string?

2005-10-22 Thread Chris F.A. Johnson
al program). If you are in a POSIX shell, parameter expansion will be a lot faster. In a python program, one of the solutions already posted will be much faster. -- Chris F.A. Johnson <http://cfaj.freeshell.org> ==

Re: Set an environment variable

2005-10-21 Thread Chris F.A. Johnson
ipt, or binary executable, you are starting a new process. Environment variables set in that process will not affect its parent (i.e., the process that called it). -- Chris F.A. Johnson <http://cfaj.freeshell.org>

Re: how to improve simple python shell script (to compile list of files)

2005-10-15 Thread Chris F.A. Johnson
compile $(find path/to -type f -name "*.py") > > # End of example > > The error message reads: > > File "", line 2 > import os, sys, py_compile; > ^ > SyntaxError: invalid syntax > > Jari > -- Chris F.A. J

Re: crosswords helper program

2005-10-12 Thread Chris F.A. Johnson
E in 5th letter...) and then > search in a dictionary the words matching this criteria import os pattern = "B...E.." wordfile = "/usr/share/dict/words" cmd = "grep -i '\<" + pattern + "\>' " + wordfile os.system( cmd )

Re: HELP: Searching File Manager written in Python

2005-10-11 Thread Chris F.A. Johnson
re I can add python scripts which I can execute >on a selected file I use gentoo (the file manager, not the Linux distro). It's not written in Python, but you can define buttons that will run any commands you like with the selected file[s] as arguments. <http://www.ob

Re: need help of RE

2005-05-29 Thread Chris F.A. Johnson
ences of any character that is not alphanumeric: import re str = "(word1 & (Word2|woRd3))" s = re.sub("[^a-zA-Z0-9]+"," ",str).split() -- Chris F.A. Johnson <http://cfaj.freeshell.org> ===

Re: How do i read just the last line of a text file?

2005-05-29 Thread Chris F.A. Johnson
On Sun, 29 May 2005 at 05:57 GMT, John Machin wrote: > Chris F.A. Johnson wrote: > >> file = open(argv[1]) ## Open the file given on the command line >> all_lines = file.readlines() ## Read all the lines > > I see your shadowing and raise you one obfuscation:

Re: How do i read just the last line of a text file?

2005-05-28 Thread Chris F.A. Johnson
file = open(argv[1]) ## Open the file given on the command line all_lines = file.readlines() ## Read all the lines last_line = all_lines[-1] ## Assign the last line -- Chris F.A. Johnson <http://cfa