unexpected wrote:
> If have a list from 1 to 100, what's the easiest, most elegant way to
> print them out, so that there are only n elements per line.
>
> So if n=5, the printed list would look like:
>
> 1 2 3 4 5
> 6 7 8 9 10
> 11 12 13 14 15
> etc.
>
> My search through the previous posts yields
John Machin wrote:
> Matimus wrote:
> > unexpected wrote:
> > > If have a list from 1 to 100, what's the easiest, most elegant way to
> > > print them out, so that there are only n elements per line.
> > >
> > > So if n=5, the printed list would
You could do something like this:
>>> class MyDict(dict):
... pass
>>> bananna = MyDict({"foo":"bar"}) #dict constructor still works
>>> bananna.name = "bananna"
>>> bananna.name
'bananna'
>>> bananna
{'foo': 'bar'}
Or, you could also just do this:
>>> bananna = {"name":"bananna"}
Depending
> the date( 8/9/2006 ) in Excel file, i am getting the value as 38938.0,
> which I get when I convert date values to general format in Excel. I
> want the actual date value. How do get that?
38938 appears to be the date in days since 1/1/1900. I'm sure someone
can help you figure out how to conver
> is it possible in python (with/without matplotlib, numpy etc) to store
> a whole class with its data into a file, instead it to reconstruct
> every time again? So is there an analogous to the matlab functions
> load/save available?
look up the pickle module.
--
http://mail.python.org/mailman/l
> This seems a really nasty hack though - any ideas for a cleaner way to
> do it?
You could overload handle_request instead. I think that makes more
sense anyway because you don't want to handle a SystemExit exception as
an error, you want to exit. Of course this only deals with catching the
excep
John Bokma wrote:
> Intelligent people don't suffer from fanboy sentiments. They just pick a
> language that works best for them.
Adding to that, they pick the language that works best for them and the
situation. Python has a significant advantage in many applications
because it is dynamic and ca
Boris wrote:
> Hi, is there any alternative software for Matlab? Although Matlab is
> powerful & popular among mathematical & engineering guys, it still
> costs too much & not publicly open. So I wonder if there's similar
> software/lang that is open & with comparable functionality, at least
Claudio Grondi wrote:
> Sometimes it is known in advance, that the time spent in a loop will be
> in order of minutes or even hours, so it makes sense to optimize each
> element in the loop to make it run faster.
> One of instructions which can sure be optimized away is the check for
> the break c
taskName and scanList are defined at the class level making them class
attributes. Each instance of the ScannerCommand class will share its
class attributes. What you want are instance attributes which can be
initialized whithin the constructor like so:
>>> class ScannerCommand:
... def __init
Someone correct me if I'm wrong (sometimes I get the terms mixed up)
but I believe that what you are seeing is due to 'number' being an
immutable type. This means that its value cannot be changed and thus
each assignment is effectively creating a new instance if int. I
believe lists are considered
It seems that you are getting some complex answers with confusing
examples. So, here is hopefully a less confusing example:
class MyDict(dict):
"""MyDict doc-string!"""
#then to use it
d = MyDict()
d['something'] = whatever you want
This solution leaves it open to do whatever you want with
I have yet to find a language/community with better online
documentation. I taught myself with the Python tutorial found at
http://docs.python.org/tut/tut.html. I would look there first. If you
are new to programming altogether I think Python may still be a good
choice, but that may not be the _bes
Brant Sears wrote:
> Hi. I'm new to Python and I am trying to use the latest release (2.5)
> on Windows XP.
>
> What I want to do is execute a program and have the results of the
> execution assigned to a variable. According to the documentation the
> way to do this is as follows:
>
> import comman
The issue is that nn() does not return an iterable object. _nn()
returns an iterable object but nothing is done with it. Either of the
following should work though:
def nn():
def _nn():
print 'inside'
yield 1
print 'before'
for i in _nn():
yield i
print 'aft
> The solution so far is:
>
> for i in xrange(len(dirs), 0, -1):
>if dirs[i-1].lower() in dirs_exclude:
> del dirs[i-1]
This won't affect much, but uses better style I think.
Change:
for i in xrange(len(dirs),0,-1):
To:
for i in reversed(xrange(len(dirs))):
and then just use 'i' inst
> Could it be as I fear, that it is impossible?
p'shaw, you underestimate the power of the Python...
I think this is a poor solution (I would go with the solution in John
Machin's second post) but here it is anyway since it does essentially
what you asked for:
[code]
def print_data(fmtstr):
Craig wrote:
> I'm trying to switch binary numbers around so that the MSB becomes the
> LSB etc.
What do you mean 'binary numbers'? They are all binary. If you mean the
int type, they are 32 bits long and there are 16 bits between the MSB
and LSB (Most/Least Significant _Byte_). Do you want to swa
Tartifola wrote:
> Hi,
> how can I sort an array like
>
> array([[5, 2],
>[1, 3]])
>
> along the first column to obtain
>
> array([[1, 3],
>[5, 2]])
> i.e. keeping track of the ordered couples?
>
> Thanks,
> A
use a sort key:
>>>from operators import getitem
>>>a = [[5,2],[1,3]]
>
> Can someone please explain why I get the following error:
The following line:
threading.Thread.__init__()
Should be written as:
threading.Thread.__init__(self)
--
http://mail.python.org/mailman/listinfo/python-list
Pyenos wrote:
> def enlargetable(table,col):
> table.append(col) # the code won't return sorted lists :-o
> return_the_fucking_table_bitch=table # assign it to a new variable to
> return it
> return return_the_fucking_table_bitch # :-|
Maybe you were just trying to be funny, but ass
[EMAIL PROTECTED] wrote:
> Any other ideas?
Well, you could always try downloading and installing python:
http://www.python.org. It is completely free. It won't run anything in
the task bar or add itself to the startup menu and it doesn't have
ads... it just sits there waiting for you to use it. I
>
> error output
> IOError: [Errno 2] No such file or directory:"filename.exe -type png
> -source sourcearg -file filename.png"
Use 'os.system' not 'execfile'. 'execfile' is for executing other
python scripts, not arbitrary command line.
Try this:
import os
...
...
os.system("filename.exe -type
I don't know of a converter, one may exist. I have seen similar
requests though and will give you a similar response to what I have
seen. A converter, if it exists, may be able to produce working code
but _not_ readable code. Python is a language whose strength comes
from, among other things, its r
Using the '+' operator for string concatonation can be slow, especially
when done many times in a loop.
>pi = pi + str("%04d" % int(e + d/a)) ## this should be fast?! I dont
The accepted solution would be to make pi an array and append to the
end...
pi = [] #create the array (empty)
...
...
> If someone is really interested in speed optimization, I can publish my
> PI-calc code.
I wouldn't mind seeing it. Chances are you will get much better help if
you post your code anyway.
-Matt
--
http://mail.python.org/mailman/listinfo/python-list
First you need to subclass the classes so that Dog actually is a
subclass of Animal which is a subclass of thing...
class Thing:
pass
class Animal(Thing):
pass
class Dog(Animal):
pass
class Weapon(Thing):
pass
class Gun(Weapon):
pass
Then you can use 'isinstance'
>>>d = Dog()
>>>is
Bummer you can't look into the registry. By convention the ProgID is
named ... Also, usually there is a
version independent ProgID that goes .. The
version independent ProgID usually points to the newest version. It
looks like that is what you are using. Many programs get away with not
using those
On Jun 4, 6:31 am, "js " <[EMAIL PROTECTED]> wrote:
> Hi list.
>
> If I'm not mistaken, in python, there's no standard library to convert
> html entities, like & or > into their applicable characters.
>
> htmlentitydefs provides maps that helps this conversion,
> but it's not a function so you have
On Jun 5, 9:14 am, [EMAIL PROTECTED] wrote:
> I need to download files off a password protected website. So if I try
> to download files off the site with python I will be blocked. Is there
> anyway to send cookies with python. So I will be authenticated.
Yes. I haven't done it but I know you shou
> I know that WxPython work only under Windows
Hmm, there seems to be some disparity between what you know and the
truth...
WxPython works everywhere (Windows, Linux, MacOS), and it works well.
Also, it has web widgets that come standard (wx.html.HtmlWindow).
Matt
--
http://mail.python.org/mai
> The solution was to recognize when we where finished with it to set
> self.over_there to None.
To my knowledge python does not handle all cyclic gc anyway. Here is
some information from the gc documentation:
[doc]
garbage
A list of objects which the collector found to be unreachable but
could
Why not just do this:
>>> def foo():
... yield 1
... yield 2
... yield 3
...
>>> f = foo()
>>> g = foo()
>>> f.next()
1
>>> f.next()
2
>>> f.next()
3
>>> g.next()
1
>>> g.next()
2
>>> g.next()
3
--
http://mail.python.org/mailman/listinfo/python-list
How are you making the list of functions? Something like this:
[code]
fs = []
for k,f in globals():
if callable(f):
fs.append(f)
[/code]
Then to call a random one (assuming they all take no parameters):
[code]
import random
random.choice(fs)()
[/code]
Or maybe you only have the name
> The first time you read the file, it has to read it from disk.
> The second time, it's probably just reading from the buffer
> cache in RAM.
I can verify this type of behavior when reading large files. Opening
the file doesn't take long, but the first read will take a while
(multiple seconds dep
On Jun 18, 1:46 pm, Ognjen Bezanov <[EMAIL PROTECTED]> wrote:
> Hello!
>
> Just to ask, is it possible to make a static dictionary in python. So
> that the keys in the dictionary cannot be removed, changed or new ones
> added, but the value pairs can.
>
> Is this possible with python?
>
> thanks,
>
On Jun 20, 9:58 am, linuxprog <[EMAIL PROTECTED]> wrote:
> hello
>
> i have that string "helloworldok" and i want to
> extract all the text , without html tags , the result should be some
> thing like that : helloworldok
>
> i have tried that :
>
> from re import findall
>
> chaine
Here is an example:
>>> s = "Helloworldok"
>>> matchtags = re.compile(r"<[^>]+>")
>>> matchtags.findall(s)
['', '', '']
>>> matchtags.sub('',s)
'Helloworldok'
I probably shouldn't have shown you that. It may not work for all
HTML, and you should probably be looking at something like
BeautifulSoup
It depends, what are you going to do if there is an exception? If you
are just going to exit the program, then that works fine. If you are
going to just skip that file, then the above wont work. If you are
going to return to some other state in your program, but abort the
file opening, you might wa
On Jun 22, 9:56 am, dmitrey <[EMAIL PROTECTED]> wrote:
> hi all,
> I have a
> y = some_func(args)
> statement, and the some_func() produces lots of text output. Can I
> somehow to suppress the one?
> Thx in advance, D.
[code]
import sys
import os
sys.stdout = open(os.devnull,"w")
[/code]
--
htt
On Jun 25, 8:29 am, Jay Sonmez <[EMAIL PROTECTED]> wrote:
> I want to be able to save some server variables as long as Apache runs
> on the server (mod_python).
>
> How is that possible in Python?
I don't have any experience with mod_python, but I'm assuming all of
the standard python modules are
On Jun 26, 10:52 am, André <[EMAIL PROTECTED]> wrote:
> I've encountered a problem using gettext with properties while using a
> Python interpreter.
>
> Here's a simple program that illustrate the problem.
> ==
> # i18n_test.py: test of gettext & properties
>
> import gettext
>
> fr = g
> I installed python, run the interpreter and the script...
Are you trying to run the script from the interpreter? You _can_ run
scripts from the interpreter, but it isn't as simple as typing the
name of the script. To me, that is what it sounds like you are trying
to do. I don't know what environ
On Jul 3, 2:27 pm, [EMAIL PROTECTED] wrote:
> Hi,
>
> I packaged up an application I am developing into an executable. In
> the application, it has user configurable options. I would like a way
> to restart the application so that the new options the user chooses
> can be applied. Firefox can resta
I'm not sure I completely understand what you want, but if you are
using Python2.5 defaultdict might be useful. Below is some example
code using defaultdict.
[code]
from collections import defaultdict
myvar = defaultdict(dict)
myvar["cat"]["paw"] = "SomeString"
myvar["dog"]["tail"] = "wags"
myv
> Actually I am using wxPython for a GUI front-end. Thus, it is already
> in a class. I am not sure how to apply your idea to a program that is
> already running in an infinite event loop.
I don't know wxPython, but I was able to grab an example program and
adapt it to do what I think you are ask
> Should SafeConfigParser.set() be escaping automatically?
It seems like that would be a nice feature. However, may I offer up
that if you are setting an option and then later on getting that value
back in the same program, you probably should have used some other
storage mechanism in the first pl
> I agree, but that was a trivial example to demonstrate the problem.
> Writing the file out to disk writes it exactly as set(), causing a get()
> to fail just the same later.
No... The above statement is not true.
The following code:
[code]
from ConfigParser import *
import sys
cp = SafeConfig
> This not only happens when get() after a set(), but with all the use cases
> above. An intervening write()/read() does not change things.
> But I'm not sure it is a bug really. If all % were escaped automatically,
> there is no way to write a templatized value. Maybe SafeConfigParser.set
> should
> This not only happens when get() after a set(), but with all the use cases
> above. An intervening write()/read() does not change things.
> But I'm not sure it is a bug really. If all % were escaped automatically,
> there is no way to write a templatized value. Maybe SafeConfigParser.set
> should
On Jul 12, 3:34 pm, Godzilla <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I'm trying to find a way to convert an integer (8-bits long for
> starters) and converting them to a list, e.g.:
>
> num = 255
> numList = [1,1,1,1,1,1,1,1]
>
> with the first element of the list being the least significant, so
>
This is a perfect place for a generator:
seq = [0xF0, 1, 2, 3, 0xF0, 4, 5, 6, 0xF1, 7, 8, 0xF2, 9, 10, 11, 12,
13, 0xF0, 14, 0xF1, 15]
def gengroups(seq):
group = []
for val in seq:
if val & 0x80 and group:
yield group
group = []
group.append(val)
> How do I ensure that the close() methods in my finally clause do not
> throw an exception?
You have no choice. If close is going to fail, it will fail.
Fortunately you can catch the exception and continue on.
try:
try:
file1.write(somestuff)
finally:
file1.close()
except
I don't have a good answer for you, but you might be interested to
read this: http://python.org/dev/peps/pep-3101/. Which according to a
recent blog post by BDFL is going to be how string formatting is done
in Python3000.
The character doesn't specify the type to expect, but the formatting
functio
I did some more experimenting and came up with the code below. It
shows several methods. When run, the script tests the robustness of
each method (roughly), and profiles it using timeit. The results from
running on my laptop are shown below the code.
seqs = [# Original:
[0xF0, 1, 2, 3, 0
> A little renaming of variables helps it be a bit more elegant I think ...
>
> def getgroups8(seq):
> groups = []
> iseq = iter(xrange(len(seq)))
> for start in iseq:
> if seq[start] & 0x80:
> for stop in iseq:
> if seq[stop] & 0x80:
>
> Which problems am I overlooking that prevent this?
1. Generators and slices serve two distinctly different tasks.
2. They may have the similar interfaces, but are implemented
differently. Each optimized for its specific task.
You are essentially asking "Why not do it?", to which I respond "Why
Python.org lists PORPIG (PORtland Python Intrest Group) but the site
that it points to no longer seems to represent that. Also, when I
looked into going to a meeting a while back, the last one listed was
some time in 2004. I will put this out there though, if someone wants
to start a PIG back up fo
On May 2, 10:21 am, HMS Surprise <[EMAIL PROTECTED]> wrote:
> On May 2, 12:03 pm, Marc 'BlackJack' Rintsch <[EMAIL PROTECTED]> wrote:
>
> > In <[EMAIL PROTECTED]>, HMS Surprise
> > wrote:
>
> > > I wish to generate a datetime string that has the following format.
> > > '05/02/2007 12:46'. The leadi
On May 2, 3:03 pm, Tobiah <[EMAIL PROTECTED]> wrote:
> >>> elegant_solution([1,2,3,4,5,6,7,8,9,10])
> [[1, 2], [3, 4], [5, 6], [7, 8], [9, 10]]
>
> --
> Posted via a free Usenet account fromhttp://www.teranews.com
>>> seq = range(1,11)
>>> seq
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
>>> zip( seq[0::2],se
On May 3, 7:44 am, Johny <[EMAIL PROTECTED]> wrote:
> On May 3, 4:37 pm, [EMAIL PROTECTED] wrote:
>
>
>
> > On May 3, 9:27 am, Johny <[EMAIL PROTECTED]> wrote:
>
> > > Let's suppose
> > > s='12345 4343 454'
> > > How can I replace the last '4' character?
> > > I tried
> > > string.replace(s,s[len(s
On May 3, 5:20 am, hg <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have started to work on a python-based robot, and am interested in your
> feedback:
>
> http://realtimebattle.sourceforge.net/www.snakecard.com/rtb
>
> hg
This is not necessarily a response to your effort, but just a note
(rant) about re
I do see one problem there...
if __name__ == 'main':
t = nBaseTest('nBaseTest')
t.logon()
That should be:
if __name__ == "__main__":
t = nBaseTest('nBaseTest')
t.logon()
It should be like that in both files.
--
http://mail.python.org/mailman/listinfo/python-list
> #3 Is there any equivalent to jfreechart and jfreereport
> (http://www.jfree.orgfor details) in python.
I haven't used either extensively but you might check out ReportLab
for report generation (http://www.reportlab.org). And MatPlotLib for
creating plots, charts and graphs (http://matplotlib.so
> I tend to use the shebang #!/usr/bin/env python in my scripts so far
> but I imagine that having that would not work on say windows. Or is
> there some kind of file extension association for people running
> windows instead of the shebang?
The shebang is ignored in Windows (as far as I know). Th
On May 16, 9:57 am, HMS Surprise <[EMAIL PROTECTED]> wrote:
> I looked in the language but did not find a switch for requiring
> variables to be declared before use.
>
> Is such an option available?
>
> Thanks,
>
> jvh
You do have to declare a variable before use. You do so by assigning
it a value
One: Not that I know of
Two: You could use list comprehension...
--- CODE --
import os
import glob
patterns = ('.\\t*.py', '.\\*.c??', '.\\*.txt')
filenames = [glob.glob(pat) for pat in patterns]
# Or as a one liner...
filenames = [glob.glob(pat) for pat
How about this:
[code]
def __add__(self,x):
return Cc14(self.r+x.r, self.i+x.i)
[/code]
However... Are you aware that Python has built in support for complex
numbers already?
>>> x = 4+5j
>>> y = 4+5j
>>> x+y
(8+10j)
>>>
--
http://mail.python.org/mailman/listinfo/python-list
> How do I get Python to put values into the elements by tag name?
The same way you create put in new elements. Only, you use
'doc.createTextNode' instead of 'doc.createElement' to create it.
from xml.dom.minidom import Document
doc = Document()
zappt = doc.createElement('zAppointments')
zap
On May 24, 9:48 am, Tartifola <[EMAIL PROTECTED]> wrote:
> Hi,
> suppose a script of python is waiting for a file from the stdin and none
> is given. How can I make the script to stop and, for example, print an
> error message?
>
> Sorry for the n00b question and thanks
I'm not exactly sure what y
On May 25, 10:50 am, "Jack" <[EMAIL PROTECTED]> wrote:
> I need to process large amount of data. The data structure fits well
> in a dictionary but the amount is large - close to or more than the size
> of physical memory. I wonder what will happen if I try to load the data
> into a dictionary. Wil
Your attemtp:
[code]
first, rest = arglist[0], arglist[1:]
[/code]
Is the most obvious and probably the most accepted way to do what you
are looking for. As for adding the fucntionality you first suggested,
it isn't likely to be implemented. The first step would be to write a
PEP though. Remember
This is a rather simplistic example, but you may be able to use a
mixin class to achieve what you need. The idea is that you write a
class that overrides only what is needed to add the new functionality.
For you it would be Color.
[code]
class Graph(object):
def _foo(self):
print "Grap
> Do you see the difference? I get a true fixed interval from the first,
> including the time to accomplish the event task(s). In the second case,
> the sleep just gets tacked on at the end of the events, not very
> deterministic (timing-wise).
Check out the sched (scheduler) module
http://docs.p
On Aug 27, 10:59 am, RyanL <[EMAIL PROTECTED]> wrote:
> I'm a newbie! I have a non-delimited data file that I'd like to
> convert to delimited.
>
> Example...
> Line in non-delimited file:
> 01397256359210100534+42050-102800FM-15+1198KAIA
>
> Should be:
> 0139,725635,9,2000,01,01,00,53
> fp=open(filename, 'r')
> for line in fp:
> # do something with line
>
> fp.close()
Or, if you are using Python 2.5+, you can use the file context via the
`with' statement.
[code]
from __future__ import with_statement # this line won't be needed in
Python 2.6+
with open(filename, 'r') as fp
> Is there a pattern matching construct in Python like (head : tail), meaning
> 'head' matches the first element of a list and 'tail' matches the rest? I
> could not find this in the Python documentation.
Not really, but you could do something like this:
[code]
def foo(head, *tail):
#do stuff
On Aug 30, 2:21 pm, fernando <[EMAIL PROTECTED]> wrote:
> Could someone post an example on how to register a python function as
> a callback in a C function? It expects a pointer to PyObject... how do
> I expose that? Basically, the signature of the function is
> foo(PyObject* obj), where obj is th
> So I think we can at least say from the chart that searches combining
> the terms 'python' and 'programming' have been falling, by some
> unquantifiable amount (it don't _look_ like much!?), relative to the
> number of total searches.
I think it is the search volume relative to the total number
> import zipfile
> class walkZip(zipfile):
> pass
>
> if __name__ == "__main__":
> print "Hello World"
`zipfile' is the name of the module, not a class. What you probably
want is this:
[code]
import zipfile
class WalkZip(zipfile.ZipFile):
pass
if __name__ == "__main__":
print
> will Py3K change the standard library names in order to follow PEP 8?)
Just continue down the list of PEPs and you will find the answer:
http://www.python.org/dev/peps/pep-3108/#modules-to-rename
This covers built-in modules. It doesn't cover 3rd party modules, like
wx. Most likely you will st
On Mar 5, 11:03 am, "Steven W. Orr" <[EMAIL PROTECTED]> wrote:
> I have a list ll of intergers. I want to see if each number in ll is
> within the range of 0..maxnum
>
> I can write it but I was wondering if there's a better way to do it?
>
> TIA
>
> --
> Time flies like the wind. Fruit flies like
On Mar 5, 1:34 pm, "Matimus" <[EMAIL PROTECTED]> wrote:
> On Mar 5, 11:03 am, "Steven W. Orr" <[EMAIL PROTECTED]> wrote:
>
> > I have a list ll of intergers. I want to see if each number in ll is
> > within the range of 0..maxnum
>
> > I
> Any ideas?
how about list comprehension (should actually work even if there is an
empty sub-list):
>>> spam = [[1,2,3],[4,5,6],[7,8,9],[10,11,12]]
>>> [parrot for egg in spam for parrot in egg]
[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]
-m
--
http://mail.python.org/mailman/listinfo/python-list
> both using os module where should I put the "import os"? In both files?
You don't really have a choice, you have to import os in both files.
Python will only load the os module into memory once, but the import
statements are needed to add the os module to the c and m module
namespaces. The code
Don't use built-ins as variable names. Your code will work if you
change this:
> methodList = [str for str in names if callable(getattr(obj, str))]
to this:
> methodList = [s for s in names if callable(getattr(obj, s))]
--
http://mail.python.org/mailman/listinfo/python-list
> Please tell me is here anything that I should change.
The way you have written it, master _must_ be a Toplevel object. So,
maybe parent is the correct name, but it doesn't really matter.
As a side note, there is no reason for this class to inherit Frame.
Aside from packing and sizing the frame,
> Any ideas to speed it up say 10 times? Or the problem only for C-like
> langs?
I dout this will speed it up by a factor of 10, but in your solution
you are mapping the values in the input file to longs. The problem
statement states that the maximum value for any of the numbers is
2**28. I assume
You might look at the bisect module (part of the standard
distribution).
--
http://mail.python.org/mailman/listinfo/python-list
On Mar 16, 11:20 am, "Matimus" <[EMAIL PROTECTED]> wrote:
> You might look at the bisect module (part of the standard
> distribution).
Here is an example:
>>> from bisect import insort
>>> x = [0,100,200,1000]
>>> insort(x,10)
>>> x
[
On Mar 26, 12:21 pm, "Adam Atlas" <[EMAIL PROTECTED]> wrote:
> Does anyone know if it would be possible to create a CPython extension
> -- or use the ctypes module -- to access Python's own embedding API
> (http://docs.python.org/api/initialization.html&c.)? Could a Python
> program itself create a
I wouldn't use threads for system calls. Checkout the subprocess
module instead. You can run multiple pipes at the same time
(subprocess.Popen). The python documentation for subprocess is pretty
good. There are a few examples. Actually, you don't even _need_ the
subprocess module, you can use os.po
On Apr 3, 8:57 am, [EMAIL PROTECTED] wrote:
> Hi! Im new to Python and doing exercise found from internet. It is
> supposed to evaluate expression given with postfix operator using
> Stack() class.
>
> class Stack:
> def __init__(self):
> self.items = []
>
> def push(self, item):
It depends on your application, but a 'set' might really be what you
want, as opposed to a list.
>>> s = set(["0024","haha","0024"])
>>> s
set(["0024","haha"])
>>> s.remove("0024")
>>> s
set(["haha"])
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 3, 12:13 pm, "bahoo" <[EMAIL PROTECTED]> wrote:
> On Apr 3, 2:31 pm, "Matimus" <[EMAIL PROTECTED]> wrote:
>
> > It depends on your application, but a 'set' might really be what you
> > want, as opposed to a list.
>
> >
On Apr 10, 12:32 pm, John Salerno <[EMAIL PROTECTED]> wrote:
> Sorry for this non-Python question, but since it's computer related I
> know you guys will have an answer, and I don't really know where else to
> ask. Mainly I'm just curious anyway.
>
> I'm wondering, why do computers use a RGB color
On Apr 12, 1:20 am, "7stud" <[EMAIL PROTECTED]> wrote:
> I can't break out of the for loop in this example:
>
> --
> import sys
>
> lst = []
> for line in sys.stdin:
> lst.append(line)
> break
>
> print lst
> ---
>
> But, I can break out of the for loop when I do this:
>
> -
On Apr 12, 8:20 am, Maric Michaud <[EMAIL PROTECTED]> wrote:
> Le jeudi 12 avril 2007 16:25, Matimus a écrit :
>
> > # Then you check to see if your file is interactive
> > if f.isatty():
> > # This is unbuffered, and will iterate the same as f
> > f =
Shriphani wrote:
> Hello all,
> I have a problem here. I have a list named list_of_files which
> contains filenames with their timestamps attached to the name. If I
> have a string "fstab", and I want to list out the files in whose names
> the word fstab appears should I go about like this :
>
> d
> Can anybody give me an hint (or some link) on how to define
> 'aCFunction' and how to call 'self.myMethod' in the C source code?
A python function defined in C accepts a pointer to self and a tuple
of arguments, each of which is also a PyObject. If you pass a function
or method, it will be inclu
1 - 100 of 280 matches
Mail list logo