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
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 )
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
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>
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>
==
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
>
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>
==
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>
=
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?
--
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
>
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
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
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.:
>>> (
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
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():
>>
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
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
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
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,
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
>>
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
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:
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>
===
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
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
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 |
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
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
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
29 matches
Mail list logo