Thanks Chris,
I figured it out after a while..
import subprocess
inputtext=my input string
process=subprocess.Popen(myprog.exe -i stdin -o
stdout,stdin=subprocess.PIPE,stdout=subprocess.PIPE,stderr=subprocess.S
TDOUT)
outputtext,errortext=process.communicate(inputtext)
..so it is fairly simple
Kent Johnson wrote:
Barnaby Scott wrote:
Can anyone explain the following: I was getting string.uppercase
returning an unexpected number of characters, given that the Python
Help says that it should normally be A-Z. Being locale-dependent, I
checked that my locale was not set to something
Hello,
Could someone who is familiar with image manipulation tell me what is
the best way to obtain the list of colors inside an image?
By best I'm referring to something that gets the job done in the fastest
way, because this operation will be repeated a number of times.
Thanks for your
Dear Users,
I'm trying to find the key of a unique value within a dictionary. Is
the code bellow a safe way of doing so, or is there a better way of
doing it?
a = {'de':'df', 'gf':'hg'}
key = a.keys()[a.values().index('hg')]
Thanks for your help,
Yours Faithfully,
Wesley Brooks
Hi everyone,
I have a quick quick question joining out of order dictionary values.
For example:
I created an empty
config={}
Added some key/value pairs
config[test1]=elem1
config[test2]=elem2
config[test3]=elem3
etc
Dumped the values and joined them at the same time.
print
Wesley Brooks wrote:
Dear Users,
I'm trying to find the key of a unique value within a dictionary. Is
the code bellow a safe way of doing so, or is there a better way of
doing it?
a = {'de':'df', 'gf':'hg'}
key = a.keys()[a.values().index('hg')]
This is safe, as long as the dict is not
Cheers for the reply.
I'm creating a custom dictionary that I can use to store list of
unique objects used in a GUI. Items are added then a unique string is
returned. I have used this approach so if an item is deleted from the
storage dictionary I can still find it using the key, where as if I
Barnaby Scott wrote:
Thanks, but this raises various questions:
I am in no way an expert on this, I am guessing...if anyone else knows
for sure what is going on, please let me know!
Why would my locale have 'changed' - and from what?
The docs for the locale module say According to POSIX, a
Sometimes psyco speeds up a script by a factor of 10, and sometimes
it makes no difference at all. Here's a case where I fully expected
it to make a difference:
http://www.rcblue.com/Python/Psyco_Puzzle.txt. Whether using psyco
or not, this takes about 13 seconds on my computer. Why no
Carlos wrote:
Hello,
Could someone who is familiar with image manipulation tell me what is
the best way to obtain the list of colors inside an image?
By best I'm referring to something that gets the job done in the fastest
way, because this operation will be repeated a number of times.
2007/1/11, raghu raghu [EMAIL PROTECTED]:
print \\.join((config[val2],config[val1],config[val3]))
elem2\elem1\elem3
or
print %s\\%s\\%s % (config[val2],config[val1],config[val3])
elem2\elem1\elem3
but this seems somehow uneligent.
Are there a more efficient/compact ways of doing this kind
Greetings. As co-chair for the upcoming volunteer-run conference in the
Dallas (Addison) area I would like to extend a *special* invitation to those
just getting started with Python. PyCon is not just for the experts and this
year we are making a special effort to reach out to those new to or
I like this solution.
Thanks everyone for all of the suggestions.
On 1/11/07, Andre Engels [EMAIL PROTECTED] wrote:
2007/1/11, raghu raghu [EMAIL PROTECTED]:
print \\.join((config[val2]
,config[val1],config[val3]))
elem2\elem1\elem3
or
print %s\\%s\\%s %
I have a list which comprises of simple random arithmetic problems for
teachers to give to their pupils. This list must be a set length (if
the teacher asks for 10 questions, they should get 10 questions), but
should not have any duplicates.
I've seen the use of sets, but this reduces the size of
Adam Cripps wrote:
I have a list which comprises of simple random arithmetic problems for
teachers to give to their pupils. This list must be a set length (if
the teacher asks for 10 questions, they should get 10 questions), but
should not have any duplicates.
I've seen the use of sets, but
On 1/11/07, Adam Cripps [EMAIL PROTECTED] wrote:
On 1/11/07, Kent Johnson [EMAIL PROTECTED] wrote:
Adam Cripps wrote:
I have a list which comprises of simple random arithmetic problems for
teachers to give to their pupils. This list must be a set length (if
the teacher asks for 10
Adam Cripps wrote:
I've not worked with Sets before but will give it a go. Is there a way
of turning the Set back to a list?
list(mySet)
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Hello,
I'm trying to do what Kent suggested, but I have a little problem, no
matter were I put my image or if I use sys.path.append to append the
folder were my Image is located it is impossible to open the image. I
know that this is a silly question but what is going on?
I like to solve
does anyone know how to do this? I need it because i want to make a binary
coverter
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On Thu, 11 Jan 2007, Amadeo Bellotti wrote:
does anyone know how to do this? I need it because i want to make a binary
coverter
s = 101001100100101
l = list(s)
l
['1', '0', '1', '0', '0', '1', '1', '0', '0', '1', '0', '0', '1', '0', '1']
___
Sometimes psyco speeds up a script by a factor of 10, and sometimes
it makes no difference at all. Here's a case where I fully expected
it to make a difference:
http://www.rcblue.com/Python/Psyco_Puzzle.txt. Whether using psyco
or not, this takes about 13 seconds on my computer. Why no
OkaMthembo wrote:
this is my first post. please could you tell me which is the best
lightweight python web framework? also, which is the best templating
language for python? (which can handle other data formats in addition to
text). so far im lured by Cheetah, although i havent done any
Arild B. Næss wrote:
I haven't found out how to change the working directory in IDLE,
though – and for some reason it seems to be a different one this
session from the last one. Does anyone know?
(I use a mac by the way.)
take a look at os.chdir()
This changes the interpreter's
Luke Paireepinart wrote:
But the main strategy is to get the data out of the ImageGrab object.
one way is stated above - use the save method to write to a file.
another possible way is to create a filelike class, implementing 'tell'
'seek' and 'write' methods, that just collects all the
Geoframer wrote:
However i switched to Ubuntu 6.10 today (from WinXP) and to my suprise
it does work under linux! :-)
Probably Numeric is included in Ubuntu's Python distro.
Hugo
___
Tutor maillist - Tutor@python.org
raghu raghu wrote:
[snip original message]
To print or to retain individual values from a list,it has to be
written in the form of
config={'test1':'elem1','test2':'elem2','test3':'elem3'}
config['test4'] = 'elem4'
print config.values()
print config['test1']- To get individual values
I'm trying to do what Kent suggested, but I have a little problem, no
matter were I put my image or if I use sys.path.append to append the
folder were my Image is located it is impossible to open the image. I
know that this is a silly question but what is going on?
sys.path contains a list
Carlos wrote:
Hello,
I'm trying to do what Kent suggested, but I have a little problem, no
matter were I put my image or if I use sys.path.append to append the
folder were my Image is located it is impossible to open the image. I
know that this is a silly question but what is going on?
On Thu, 11 Jan 2007, Terry Carroll wrote:
On Thu, 11 Jan 2007, Amadeo Bellotti wrote:
does anyone know how to do this? I need it because i want to make a binary
coverter
s = 101001100100101
l = list(s)
l
['1', '0', '1', '0', '0', '1', '1', '0', '0', '1', '0', '0', '1', '0', '1']
By
Amadeo Bellotti wrote:
does anyone know how to do this? I need it because i want to make a
binary coverter
list('abc')
['a', 'b', 'c']
--
Bob Gailer
510-978-4454
___
Tutor maillist - Tutor@python.org
Hello,
Well seems like Danny was right, the backslashes were the problem! This
really got an 11 in my frustration meter.
Thanks for your help
Carlos
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Let's say I have a series of files that are named like
so:
0001.ext
0230.ext
0041.ext
0050.ext
How would I convert these from a padding of 4 to a
padding of 1? In other words, I want the files to be
renamed as:
1.ext
230.ext
41.ext
50.ext
At first I used strip(), which was a mistake because
On 12/01/07, Christopher Spears [EMAIL PROTECTED] wrote:
Let's say I have a series of files that are named like
so:
0001.ext
0230.ext
0041.ext
0050.ext
How would I convert these from a padding of 4 to a
padding of 1? In other words, I want the files to be
renamed as:
1.ext
230.ext
Why not sorting the items and throw out all multiples until you reach
the fixed length ?
Klaus Ramelow
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
On Thu, 11 Jan 2007, Christopher Spears wrote:
Let's say I have a series of files that are named like
so:
0001.ext
0230.ext
0041.ext
0050.ext
How would I convert these from a padding of 4 to a
padding of 1? In other words, I want the files to be
renamed as:
1.ext
230.ext
41.ext
35 matches
Mail list logo