Laszlo Nagy wrote:
> >>
> > Nope. StringI is an input-only object, StringO is an output object. You
> > got a StringI because you gave a string argument to the creator.
> >
> >
> > >>> f1 = cStringIO.StringIO()
> > >>> f1
> >
> > >>> dir(f1)
> > ['__class__', '__delattr__', '__doc__', '__getat
def getline(n, data_file, index_file):
'''
Return line n from data file using index file.
'''
n = F(n, index_file)
f = open(data_file)
try:
f.seek(n)
data = f.readline()
finally:
f.close()
return data
if __name__ == '__main__':
dfn, ifn, lineno = sys.argv[-3:]
n = int(lineno)
print getline(n, dfn, ifn)
Hope this helps,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
27;t use 'str' for a variable name.
Second, "%04i" % i creates a string, don't call str() on it.
Third, str(1) will always be "1" so just add that to your format string
already "1%04i" % i
(And if the "XXX" part is also constant then add that too: "XXX1%04i" %
i)
Finally, you can say:
for i in xrange(1,10):
s = "XXX1%04i" % i
if s not in list1 and s not in list2:
print s
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
Simon Forman wrote:
> Finally, you can say:
>
> for i in xrange(1,10):
> s = "XXX1%04i" % i
> if s not in list1 and s not in list2:
> print s
>
> HTH,
> ~Simon
D'oh! Forgot to break.
for i in xrange(1,10):
s = "XXX1%04
placid wrote:
> Simon Forman wrote:
> > placid wrote:
> > > Hi all,
> > >
> > > I have two lists that contain strings in the form string + number for
> > > example
> > >
> > > >>> list1 = [ ' XXX1', 'XXX2
ou work with cowboys, not Python nor any other language can help
you. Bad code can be written in any language.
Rigorously enforced standards re unit tests might be of benefit, though.
--
Cheers,
Simon B,
[EMAIL PROTECTED],
http://www.brunningonline.net/simon/blog/
--
http://mail.python.org/mailman/listinfo/python-list
On 26 Jul 2006 04:55:37 -0700, wscrsurfdude <[EMAIL PROTECTED]> wrote:
> Sorry it is so hot in here, I make mistakes, I meant it to be an xml
> file. But still sthe same problem
Check out elementtree - <http://effbot.org/zone/element-index.htm>.
--
Cheers,
Simon B,
[EMAI
filename parts of the paths.
test = set(map(os.path.basename, list1))
test |= set(map(os.path.basename, list2))
(Note: I *was* being stupid last night, the + operator doesn't work for
sets. You want to use | )
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
this:
import delmepy.mod2
delmepy.mod2.banana(23)
The following (at the interactive prompt) worked fine:
>>> import delmepy.subp.mod3
23
I would assume (but I haven't checked) that this should work as long as
delmepy (in your case PackageFolder) was somewhere on sys.path.
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
I find the "Tkinter reference: a GUI for Python" under "Local links" on
this page http://infohost.nmt.edu/tcc/help/lang/python/tkinter.html to
be very helpful. It has a decent discussion of the grid layout
manager.
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
it__(self, **kargs) # call the constructor method in
Super
(add two asterisks to the call.)
Observe, the following script:
def a(*a, **b):
return a, b
print a(**{'arg':2})
print a(arg=2)
print a({'arg':2})
# Prints:
((), {'arg': 2})
((), {'arg': 2})
(({'arg': 2},), {})
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
rite(line)
> index.write("\n")
>
> index.close()
Add a color attribute to the DirectoryWalker class, change it when you
change directories, return it with the fullname. Change your for loop
like so:
for color, file in DirectoryWalker("."):
# ...
I think that should work.
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
out forgetting the system call and just using the bz2 standard
library module?
http://docs.python.org/lib/module-bz2.html
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
.append(os.path.split(sys.argv[0])[0])
> in the script I care most about. It works,
> but seems like a hack.
>
> Thanks,
> Alan Isaac
Hack or not, that's what I would do. In fact I have done that. I hope
if there's a better way that someone will post it here. ;-)
Peac
Wolfgang wrote:
> Hi Simon,
>
> I did not know that library! I'm still new to python and I still have
> problems to find the right commands.
Welcome. : ) Python comes with "batteries included". I'm always
finding cool new modules myself, and I've been
File "", line 1, in ?
> TypeError: unsupported operand type(s) for &: 'float' and 'int'
>
> Is there some easy way to get what the bytes of the float are?
>
> Thanks in advance:
> Michael Yanowitz
The struct module. (It also works for ints. ;-) )
http://docs.python.org/lib/module-struct.html
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
Michael Yanowitz wrote:
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] Behalf
> Of Simon Forman
> Sent: Wednesday, July 26, 2006 2:56 PM
> To: python-list@python.org
> Subject: Re: Splitting a float into bytes:
>
>
> Mic
\S+
''', s, re.VERBOSE)
print splitup(s)
# Prints
['a', '(b c)', 'd', '[e f g]', 'h', 'i(j k)', 'l', '[m n o]p', 'q']
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
Qiangning Hong wrote:
> Tim Chase wrote:
> > >>> import re
> > >>> s ='a (b c) d [e f g] h ia abcd(b c)xyz d [e f g] h i'
> > >>> r = re.compile(r'(?:\S*(?:\([^\)]*\)|\[[^\]]*\])\S*)|\S+')
> > >>> r.findall(s)
> > ['a', '(b c)', 'd', '[e f g]', 'h', 'ia', 'abcd(b c)xyz', 'd',
> > '[e f g]', 'h
e string or
> read-only character buffer, not Set" and out.write( str(clean) )
> creates "Set(['A', 'C', 'B', 'D'])" instead of just A,B,C,D.
>
> thanks in advance for your time,
>
> -matt
Do ','.join(clean) to make a single string with commas between the
items in the set. (If the items aren't all strings, you'll need to
convert them to strings first.)
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
bytecode or other tricks even more hackish than what I've already done.
>
> For the record, the code I was using was :
>
> x = 3
> def f(x):
> print x
>
> CodeType = type(f.func_code)
>
> def convert_function(f):
> code = f.func_code
>
one,
would be happy to comment it for you to explain how it works. It's so
nice and elegant that I've already cut-and-pasted it into my own
"notebook" of cool useful python "patterns" to use in the future.
Reread it slowly, think about what it's doing, if quest
mean in this case? No read permissions? In use by
another program?
I haven't used windows in a long time, and I wasn't aware that one
could lock files in it.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
Duncan Booth wrote:
> Simon Forman wrote:
>
> > If you need help understanding it please ask questions. I, for one,
> > would be happy to comment it for you to explain how it works. It's so
> > nice and elegant that I've already cut-and-pasted it into my own
&g
Will McGugan wrote:
> Hi,
>
> I've been using Python for years, but I recently encountered something
> in the docs I wasnt familar with. That is, using two arguements for
> iter(). Could someone elaborate on the docs and maybe show a typical use
> case for it?
>
>
> Thanks,
>
> Will McGugan
>
> --
t;
> Thanks,
>
> Will McGugan
>
> --
> work: http://www.kelpiesoft.com
> blog: http://www.willmcgugan.com
D'oh! You said *elaborate*... Sorry. Fredrik Lundh gives a great
example of it's use in this thread:
http://groups.google.ca/group/comp.lang.python/browse_frm/threa
Will McGugan wrote:
> Hi,
>
> I've been using Python for years, but I recently encountered something
> in the docs I wasnt familar with. That is, using two arguements for
> iter(). Could someone elaborate on the docs and maybe show a typical use
> case for it?
>
>
> Thanks,
>
> Will McGugan
>
> --
27;8', '12')]
now that you have the data for each line, you can combine them with the
string join() method:
|>> data = zip(a, b, c)
|>> for datum in data:
... print ' '.join(datum)
...
1 5 9
2 6 10
3 7 11
4 8 12
You can print to an open file object, so the above loop will do what
you need:
|>> f = open('output.txt', 'w')
|>> for datum in data:
... print >> f, ' '.join(datum)
...
|>> f.close()
|>> print open('output.txt').read()
1 5 9
2 6 10
3 7 11
4 8 12
I hope that helps!
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
e
Applies the function (which should take one argument) to each pixel in
the given image. If the image has more than one band, the same function
is applied to each band. Note that the function is evaluated once for
each possible pixel value, so you cannot use random components or other
generators
Chaos wrote:
> Simon Forman wrote:
> > Chaos wrote:
> > > As my first attempt to loop through every pixel of an image, I used
> > >
> > > for thisY in range(0, thisHeight):
> > > for thisX in range(0, thisWidth):
> > >
placid wrote:
> Hi all,
>
> I have been looking into non-blocking read (readline) operations on
> PIPES on windows XP and there seems to be no way of doing this. Ive
> read that you could use a Thread to read from the pipe, but if you
> still use readline() wouldnt the Thread block too?
Yes it wil
uture.
T = time() + INTERVAL
# Serve requests until then.
while time() < T:
server.handle_request()
# Check whatever.
if check():
# Do something, for example, stop running.
RUN = False
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
Kirt wrote:
> By locked files i mean Outlook PST file while Outlook has it open
>
> Simon Forman wrote:
> > Kirt wrote:
> > > i have a code that backsup file from src to dest.
> > > Now if some of the files are locked , i need to skip those files..
> > &
Simon Forman wrote:
> Chaos wrote:
> > Simon Forman wrote:
> > > Chaos wrote:
> > > > As my first attempt to loop through every pixel of an image, I used
> > > >
> > > > for thisY in range(0, thisHeight
erates for you. You can convert this to Python and generalise the
bits you need to.
There, that's a starting point. Let us know what you come up with!
Give us a shout if you have any problems.
--
Cheers,
Simon B,
[EMAIL PROTECTED],
http://www.brunningonline.net/simon/blog/
--
http://mail.python.org/mailman/listinfo/python-list
> greater-than". The "dot dot dot" isn't nearly as bad.
Change sys.ps1 and sys.ps2: <http://tinyurl.com/lgqth>.
--
Cheers,
Simon B,
[EMAIL PROTECTED],
http://www.brunningonline.net/simon/blog/
--
http://mail.python.org/mailman/listinfo/python-list
output_file.write(line)
Check out the docs on the file object for more info:
http://docs.python.org/lib/bltin-file-objects.html
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
...
>
> That alone does not work. If server.handle_request() blocks,
> you don't get to the check(). You need some kind of timeout
> in handle_request().
>
>
> --
> --Bryan
Ach! You're right. I didn't consider that handle_request() might
block..
--
http://mail.python.or
27;s (instance of D) mro will be (D, B, C, A,
object), so as super gets called in each class, it looks in that list
(tuple, whatever) for the class following it (actually the next class
following it that implements the method).
Since no class appears in that list more than once, each class's
im
Python-3000 is better
integration of the standard library with the new-ish standard logging
system, so if you do a good job send it in. ;-)
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
pening when running independent script. I don't know what is right.
>
> I really would like to know what is going on my system and how to clear
> the past information. Thank you.
It looks like you might have a file named 'time.py' in the same
directory as your 'x.py'. If so, move it away (or rename it) and try
again.
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
bruce wrote:
> hi.
>
> within python, what's the best way to automatically spawn an app as a given
> user/group.
>
> i'm testing an app, and i'm going to need to assign the app to a given
> user/group, as well as assign it certain access rights/modes (rwx) i then
> want to copy the test app to a gi
>> newf = pickle.loads(pstr)
|>> newf
<__main__.foo instance at 0xb664690c>
Pickle is simple and should work "out-of-the-box". I wouldn't mess
with XML until I was sure I needed it for something.
What kind of trouble were you having with pickle?
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
Philippe, please! The suspense is killing me. What's the cpu!?
For the love of God, what's the CPU?
I-can't-take-it-anymore-it's-such-a-simple-question-ingly yours,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
ert the list back into one string use the join() method; if you
kept the line endings,
s = "".join(lines)
or if you threw them away,
s = "\n".join(lines)
Python has standard modules for sha-1 digest, sha, and zlib
compression, zlib. See http://docs.python.org/lib/lib.html
HTH, enjoy,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
utomaticaly, but there are toolkits such as SQLObject and SQL Alchemy
that can automate this as well.
Best regards,
Simon Hibbs
--
http://mail.python.org/mailman/listinfo/python-list
's clear to anyone coming across it.
Simon Hibbs
--
http://mail.python.org/mailman/listinfo/python-list
rest of the body of the Validate() method
(i.e. same as the try statement, "text_ctrl = ..." statements.)
If that's not an artifact of posting it here then you'll need to
correct that.
Also, there's no need to declare the function a staticmethod, since it
isn't.
Other than that it looks ok to me, but I might have missed something.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
Simon Forman wrote:
> John Salerno wrote:
> > John Salerno wrote:
> > > The code to look at is the try statement in the NumbersValidator class,
> > > just a few lines down. Is this a clean way to write it? i.e. is it okay
> > > to have all those return statem
if not result:
wx.MessageBox('Enter a valid time.', 'Invalid time entered',
wx.OK | wx.ICON_ERROR)
return result
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
onError) :
> wx.MessageBox('Enter a valid time.', 'Invalid time entered',
>wx.OK | wx.ICON_ERROR)
> return False
>
> hth, BB
Assertion statements "go away" when you run python with the '-O' or
'-OO' options. They're only meant for debugging and shouldn't be used
as part of your actual program logic.
You run the risk of introducing hard-to-find bugs if you use them like
this and somebody, somewhere, sometime runs your code in "optimized"
mode.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
month, day).toordinal()
> > Jim
No, the st_ctime member isn't the creation time on *nix, from the os
module docs: "st_ctime (platform dependent; time of most recent
metadata change on Unix, or the time of creation on Windows)"
I hope somebody does post a solution to this, as I'd like to know how
to get the creation time of a file on linux, et. al.
It may be impossible:
http://www.faqs.org/faqs/unix-faq/faq/part3/section-1.html
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
Brian Beck wrote:
> OriginalBrownster wrote:
> > I want to zip all the files within a directory called "temp"
> > and have the zip archive saved in a directory with temp called ziptemp
> >
> > I was trying to read up on how to use the zipfile module python
> > provides, but I cannot seem to find ad
n to use, say, postgres will be similar to
the time you'd spend implementing what you've described above, but with
at least 10 to 100 times the payoff.
As for updating the client on the fly, one strategy would be to keep
the "dynamic" code in it's own module and have the clients reload()
that module when you upload a new version of it to the client machines.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
, if it completes while the
> previous thread is doing the zipping work ?
The other threads will just take the next request from the Queue and
process it. They won't "care" what the one thread is doing,
downloading, zipping, whatever.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
vel __all__ list, or not
starting with an underscore of no such list has been defined.
And if none of those are what you meant by the opposite of an import,
you'll need to be more explicit. ;-)
--
Cheers,
Simon B,
[EMAIL PROTECTED],
http://www.brunningonline.net/simon/blog/
--
http://mail.python.org/mailman/listinfo/python-list
On 8/3/06, Simon Brunning <[EMAIL PROTECTED]> wrote:
> If you want to remove the module from a namespace into which you
> imported it, you can do that with del:
>
> import amodule
> amodule.afunction() # Works fine
>
> del amodule
> amodule.afunction() # Will die n
ting datetime object, only create a new one.
--
Cheers,
Simon B,
[EMAIL PROTECTED],
http://www.brunningonline.net/simon/blog/
--
http://mail.python.org/mailman/listinfo/python-list
c references. Ordinary reference counting *would* remove the
module as soon as you de referenced it, but for the fact that Python
stashes a reference to the module in (IIRC) sys.__modules__. And you
mess with *that* at your peril. ;-)
--
Cheers,
Simon B,
[EMAIL PROTECTED],
http://www.brunnin
s.modules, not sys.__modules__.
--
Cheers,
Simon B,
[EMAIL PROTECTED],
http://www.brunningonline.net/simon/blog/
--
http://mail.python.org/mailman/listinfo/python-list
lly still has the same ID, but it also still has the same value.
--
Cheers,
Simon B,
[EMAIL PROTECTED],
http://www.brunningonline.net/simon/blog/
--
http://mail.python.org/mailman/listinfo/python-list
strings will need to be escaped (otherwise, because the
newlines are statement separators, you will have one print statement
followed by string literals with the wrong indentation.)
print "Usage: blah blah blah\n" \
"Some more lines in the usage text\n" \
"Some more lines here too."
(Note that the final string literal newline is not needed since print
will add one of it's own.)
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
Kkaa wrote:
> This seems like the right thing to do, but it runs the program in the
> background, and I need my program to wait until the x.exe has finished.
> I tried using this code:
>
> p =
> subprocess.Popen("x.exe",shell=True,stdout=subprocess.PIPE,stdin=subprocess.PIPE,
> stderr=subprocess.P
riable in os.environ, but I don't know if
windows sets this correctly in all cases.
(os.environ is documented in
http://docs.python.org/lib/os-procinfo.html)
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
ething else here
return
# Compute the closeness of the first value.
closest = abs(z - exvalue)
# Create a var to store the closest key
result = u
# Iterate through the rest of the dict.
for u, z in diter:
# Compute the closeness.
v = abs(z - exvalue)
# Check if it's closer than the closest.
if v < closest:
# If so, store the new closest.
closest = v
# And store the new closest key.
result = u
return result
I hope that helps. :-)
Python is an amazing language once you get the hang of it. Enjoy.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
tError: No module named ag
<http://agtk.sourceforge.net/>, perhaps? If not, we'll need more context.
--
Cheers,
Simon B,
[EMAIL PROTECTED],
http://www.brunningonline.net/simon/blog/
--
http://mail.python.org/mailman/listinfo/python-list
have to pass your
counter around or *shudder* use a global variable.
def g(n=0):
'''n is the number of recursions...'''
if n < 4:
return g(n + 1)
else:
return n
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
e read() method. Or, if it is, something
very very weird is going on.
If you can do the above and not get the same results I'd be interested
to know what file data you have, what OS you're using.
Peace,
~Simon
(Think about this: More people than you have tried the challenge, if
ht also ask on the boost python list:
http://www.boost.org/more/mailing_lists.htm
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
236
And of course there's the 'email' standard library module:
http://docs.python.org/lib/module-email.html
HTH,
~Simon
Out of curiosity, why do you want to _backup_ a gmail account? (I use
my gmail account to backup files and documents I never want to lose.)
I could think of some reas
Janto Dreijer wrote:
> Janto Dreijer wrote:
> > John Henry wrote:
> > > Simon Forman wrote:
> > > > >
> > > > > False not in logflags
> > > > >
> > > >
> > > > Or, if your values aren't already bools
>
>
> > def run(request, response, func=copy_first_match):
> > # And so on...
>
> Thanks. That did it. :-)
>
> Ritesh
Another thing you might want to consider would be to split your
download and zipping code into separate functions then create one more
thread to do all the zipping.
[EMAIL PROTECTED] wrote:
> Hi,
>
> there are many ways of solving the problem of finite buffer sizes when
> talking to a subprocess. I'd usually suggest using select() but today I
> was looking for a more readable/understandable way of doing this. Back
> in 1997 Guido himself posted a very nice sol
Cameron Laird wrote:
> In article <[EMAIL PROTECTED]>,
> Simon Forman <[EMAIL PROTECTED]> wrote:
> >David Bear wrote:
> >> Is there an easy way to get the current level of recursion? I don't mean
> .
> .
>
e
from the command line.
For example, on my [linux] system /usr/local/bin/idle contains this:
#!/usr/bin/python
from idlelib.PyShell import main
if __name__ == '__main__':
main()
You also get a modest performance boost because the interpreter will
only process the text of this small script but will use the precompiled
byte-code .pyc files (when available) of your main module, rather than
re-parsing its text.
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
r-xr-x 3 sforman sforman 4096 2006-06-21 20:59 tests',
'-rw-r--r-- 1 sforman sforman 898 2006-07-09 21:53 TODO',
'drwxr-xr-x 3 sforman sforman 4096 2006-08-05 17:37 util']
In [3]: data = [n.split() for n in _[1:]]
In [4]: print data[2][4]
887
In [5]:
etc...
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
godavemon wrote:
> I'm using python's struct and binascii modules to write some values
> from my parser to binary floats. This works great for all of my binary
> files except one. For some reason this file is saving to 836 (stated
> by my command shell) bytes instead of 832 like it should. It so
normal bash things, like installing, etc.?
"normal bash things"? :-) Yes, most commands can be run by putting an
'!' before them. If you ever need to run something that for some
reason doesn't work with this, you can always run !bash and do it in
bash. :-)
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
ding and posting to
c.l.p in the last couple of months, it's that there's *plenty* of
pointless junk around already.) One exception to "don't sprinkle
things" would be print statements, but even there, don't sprinkle
randomly...) :-)
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
3
4
5
6
7
8
9
the form "for var in string:" simply assigns each character (string of
length one, technically) in the string to the var variable at each
iteration.
HTH,
~Simon
(BTW, "ur" is "your" and "u" is "you". I'm sorry to nitpick, but it's
a personal idiosyncrasy of mine to be bothered by such.)
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
> Simon Forman:
> > It's unlikely to
> > be deprecated since it doesn't make much sense to make it an attribute
> > of the str type.
>
> Why?
>
> Thank you,
> bearophile
Let me toss the question back at you: Does it make se
ds4ff1z wrote:
> Hello, i'm looking to find and replace multiple characters in a text
> file (test1). I have a bunch of random numbers and i want to replace
> each number with a letter (such as replace a 7 with an f and 6 with a
> d). I would like a suggestion on an a way to do this. Thanks
http
.endswith(extension):
files_with_ext.append(filename)
The above is exactly equivalent to the [filename for filename in
files... ] form.
AFAIK, os.listdir('.') works fine, but you can also use
os.listdir(os.getcwd()). However, both of those return the current
directory, which ca
m([x[0] for x in self.data])", etc.. you can leave out
the []'s. There's no need to create a list, the ()'s in the call to
sum() suffice to make a generator comprehension.
FWIW, if you're still having trouble later I'll try to take another
look at your code. Print statements and debuggers are your friends,
and John Machin's advice seems good to me.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
27;d like to say is something like
> this:
> y = [t.reverse() for t in y]
> Even if reverse worked on tuples, it wouldn't work inside a
> list comprehension.
>
> Yours,
> Noah
If your tuples are all two items, you can do it like this:
y = [(b, a) for a, b in y]
if not, then:
y = [tuple(reversed(t)) for t in y]
:-D
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
, can I still retain this second structure and still
> test for > 0, but not have any extra nesting?
>
> Thanks.
What about the version I gave you 8 days ago? ;-)
http://groups.google.ca/group/comp.lang.python/msg/a80fcd8932b0733a
It's clean, does the job, and doesn't have any extra nesting.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
ferences
> > Visible links
> > 1. [2]http://quotes.nasdaq.com/quote.dll?page=nasdaq100
> >
> >--
> >[3]http://mail.python.org/mailman/listinfo/python-list
> >
> >--
> >Brendon Towle, PhD
> >Cognitive Scientis
would be useful or appropriate?
Simon Hibbs
--
http://mail.python.org/mailman/listinfo/python-list
; root:xnu-792.6.70.obj~1/
> RELEASE_PPC', 'Power Macintosh', 'powerpc')
>
> That's on Mac OS X 10.4.6. Indeed more useful.
>
> Michiel
It might be a good idea to write a brief script to print out
sys.platform, platform.platform(), platform.uname(), etc.. and post it
here for people to run and post their results.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
index in S where substring sub is found,
such that sub is contained within s[start,end]. Optional
arguments start and end are interpreted as in slice notation.
Return -1 on failure.
Enjoy
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
ee... well, actually, nevermind
that.
Double check that the first line really is being sent (with netcat or
telnet or something.) That's the only thing I can think of, your code
should be working.. If the first line is really being sent, but not
arriving in your code, you've got
indow(form2)
> I can not see the image from wx.BufferedDC anywhere and don't know what
> is going on.
>
> I need your help. Thanks a lot.
>
Have you tried http://wiki.wxpython.org/index.cgi/Asking_For_Help
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
ing_blocks() if n == c]
[3]
There may be better ways.
>
> my real problem involves figuring out how to reduce the number of hits to
> the db/tbl...
What?
>
> thanks
>
> ps. if this is confusing, i could provide psuedo-code to make it easier to
> see...
Yes, please.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
being a string / a cStringIO / something pickled
>
> The obvious
>
> cPickle.dumps(hicon) leads to nothing, cause it only gets the ID of the
> hicon :(
>
> Any ideas / recommendations / tipps?
>
> Harald
Write the data to a temporary file and load it from there.
(Als
John Salerno wrote:
> Simon Forman wrote:
>
> > What about the version I gave you 8 days ago? ;-)
> >
> > http://groups.google.ca/group/comp.lang.python/msg/a80fcd8932b0733a
> >
> > It's clean, does the job, and doesn't have any extra nesting.
>
rsh, but use try..except blocks.
If your code is getting "tangled and nasty looking" you probably need
to break it up into small[er] functions, or redesign it somehow.
Peace,
~Simon
(Also, there's no such thing as sys.error, do you mean
sys.excepthook()?)
--
http://mail.python.org/mailman/listinfo/python-list
Slawomir Nowaczyk wrote:
> On Thu, 10 Aug 2006 11:39:41 -0700
> f pemberton <[EMAIL PROTECTED]> wrote:
>
> #> I have kind of an interesting string, it looks like a couple hundred
> #> letters bunched together with no spaces. Anyway, i'm trying to put a
> #> "?" and a (\n) newline after every 100t
s suggestion of presenting your code as a web service
is a good one.
Peace,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
OO was (is?) a
Multi-User Dungeon that had (has?) a model of processing that allowed
you to create programmed objects that received a "budget" of processor
time. The objects would not work if they "ran out" of processor
time...
Perhaps something like this could help you? (Sorry to be so vague.)
HTH,
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
he Dapper Drake - released in June 2006.
[EMAIL PROTECTED]:~ $ cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 8
model name : Pentium III (Coppermine)
HTH, ;-)
~Simon
--
http://mail.python.org/mailman/listinfo/python-list
601 - 700 of 1585 matches
Mail list logo