Arnaud Delobelle wrote:
Here is a very simple way to improve what you do, which won't require
you to change the way you work or to learn a new paradigm:
Instead of testing your functions interactively, put your testing code
in a file, e.g. 'program_tests.py'. Your can then type
python prog
Dear Folks,
I am currently developing a python program, let us call it "generic.py",
and I am testing out the functions therein by testing them out
interactively in the python interpreter by invoking python and doing
import generic
Once I hit an error, I need to revise my file and reload the
Alf P. Steinbach wrote:
* R (Chandra) Chandrasekhar:
width = 5
height = 30
colors = ['#abcdef]', '#456789']
filename = "/tmp/image.png"
# I want to get the equivalent of variable interpolation in Perl
# so that the command
#
# convert -size 5x30 gradient:#abcdef
Peter Otten wrote:
import subprocess
def convert(width=5, height=30, colors=['#abcdef', '#456789'],
filename="tmp/image with space in its name.png"):
lookup = locals()
assert all("\n" not in str(s) for s in lookup.values())
subprocess.call("""\
convert
-size
{width}x{heig
Peter Otten wrote:
import subprocess
def convert(width=5, height=30, colors=['#abcdef', '#456789'],
filename="tmp/image with space in its name.png"):
lookup = locals()
assert all("\n" not in str(s) for s in lookup.values())
subprocess.call("""\
convert
-size
{width}x{hei
Dear Folks,
I want to execute a command from within python using the subprocess module.
Coming from a Perl background, I thought I could use variable
interpolation in strings, but found that this is neither supported nor
the Python way. Accordingly, I am a little at sea about how to
accomplis
MRAB wrote:
You'd have to post an example of that, but you could try deleting some
of the entries before sorting so see whether you can still reproduce the
problem with a smaller list.
John Posner wrote:
Please cut-and-paste the exact error message (or other evidence of
"failure") into a mess
Dear Folks,
I have lines of values like so:
14, [25, 105, 104]
10, [107, 106, 162]
21, [26, 116, 165]
I need to sort them in two ways:
(a) By the numeric value of the first column; and
(b) by the sum of the elements of the second item in each list, which is
a list in itself.
At present, I
Dear Folks,
I have read that one should use a dictionary in python to accommodate
dynamic variable names. Yet, I am puzzled how to achieve that in my
case. Here is what I want to do:
1. The user inputs a number of six-digit hex numbers as a
comma-separated list. These numbers represent colou