Thomas Lotze wrote:
> It's definitely no help that file-like objects are iterable; I do want
> to get a character, not a complete line, at a time.
Hi,
if i did understand what you mean, what about using mmap? Iterating over
characters in a file like this:
# -*- coding: iso-8859-1 -*-
import os
Steven Bethard <[EMAIL PROTECTED]> writes:
> $ python -m timeit "for x in (i for i in xrange(10)): y = x"
> 10 loops, best of 3: 4.75 usec per loop
Yowza! One of the features I really liked in Perl has shored Python island
somewhere in the 2.4'ies, it seems[1]. Thanks for the tip!
PS. In cas
Suppose one wants to fetch the following data from given network interface,
say, eth0:
>>> Ethinf('eth0').addr()
'192.168.1.42/24'
>>> Ethinf('eth0').route('default')
'192.168.1.1'
>>> Ethinf('eth0').duplex()
'full'
>>> Ethinf('eth0').speed()
100
Some statistics:
>>> Ethstat('eth0').rx_bytes()
Thomas Lotze wrote:
> I think I need an iterator over a string of characters pulling them out
> one by one, like a usual iterator over a str does. At the same time the
> thing should allow seeking and telling like a file-like object:
>>> from StringIO import StringIO
>>> class frankenstring(Strin
Alex Dempsey wrote:
> Recently I tried to slice every element of a list of strings. First I tried:
>
> f = open("export.xls", "r")
http://www.python.org/doc/2.4.1/lib/module-csv.html
(snip, see other posts in this thread)
--
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for
Steven D'Aprano <[EMAIL PROTECTED]> writes:
> My opinion is, no, you don't need to be a C programmer, or an assembly
> programmer, or a hardware level physicist who understands NAND gates, but
> it is very useful to have some understanding of what is going on at the
> low-level implementation.
Ye
Thanks for making me aware of the security loophole of the web app i am
planning.
Godwin Burby
--
http://mail.python.org/mailman/listinfo/python-list
Peter Hansen <[EMAIL PROTECTED]> writes:
>> "first make it work, then make it right, then make it fast"
...
> The expression describes (most recently, if not originally) the practice in
> Test-Driven Development (TDD) of making your code pass the test as quickly as
> possible, without worrying ab
Am Montag, den 04.07.2005, 20:25 -0400 schrieb Roy Smith:
> Steven D'Aprano <[EMAIL PROTECTED]> wrote:
> > Should we *really* be encouraging newbies to mess with globals() and
> > locals()? Isn't that giving them the tools to shoot their foot off before
> > teaching them how to put shoes on?
>
> W
Am Montag, den 04.07.2005, 15:36 -0400 schrieb Jeffrey Maitland:
> Hello all,
>
Ok, first thing to consider is that time.sleep in Python does in reality
(on Debian Linux, Python2.3) a select syscall with 3 NULLs to wait the
time. (The "real" sleep POSIX call might have stupid interactions with
si
Am Dienstag, den 05.07.2005, 08:37 -0700 schrieb Jonathan Ellis:
> In many ways, Python is an incredibly bad choice for deeply
> multithreaded applications. One big problem is the global interpreter
> lock; no matter how many CPUs you have, only one will run python code
> at a time. (Many people
Am Donnerstag, den 07.07.2005, 22:56 + schrieb Grant Edwards:
> Oh. I assumed that CPython used Posix threads on Posix
It does.
> platforms. At least in my experience under Linux, libpthread
> always creates an extra "manager" thread. Though in our case
It probably does. But it will probabl
Am Mittwoch, den 06.07.2005, 04:00 + schrieb Dennis Lee Bieber:
> {I'm going to louse up the message tracking here by pasting part of
> your
> follow-up into one response}
>
> 2> Upon further thought, that just can't be the case. There has
> 2> to be multiple instances of the intepreter becau
Am Mittwoch, den 06.07.2005, 14:38 + schrieb Grant Edwards:
>
> Unfortunately that means you've got to debug a number cruncher
> that's written in C.
If one is careful, one can use Pyrex :)
Andreas
signature.asc
Description: Dies ist ein digital signierter Nachrichtenteil
--
http://mail.p
Am Mittwoch, den 06.07.2005, 12:27 -0700 schrieb Jonathan Ellis:
> Your sarcasm is cute, I suppose, but think about it for a minute. If
> the opposite of what I assert is true, why would even the mainstream
> press be running articles along the lines of "multicore CPUs mean
> programming will get
Roland Heiber wrote:
> if i did understand what you mean, what about using mmap?
AIUI (and as a little experimenting seems to confirm), you can't
reposition an iterator over an mmap'ed file by seeking. True, you have
both iterating by characters and seeking/telling, but the two
functionalities do
Bengt Richter wrote:
> < lotzefile.py >--
Thanks.
[...]
> byte = self.buf[self.pos]
This is the place where the thing is basically a str whose items are
accessed as sequence elements. It has some iterator behaviour and file
management
Peter Otten wrote:
class frankenstring(StringIO):
> ... def next(self):
> ... c = self.read(1)
> ... if not c:
> ... raise StopIteration
> ... return c
Repeated read(1) on a file-like object is one of the ways of doing it with
exist
Dear all,
Is there any php equivalent
move_uploaded_file($source_path, "$upload_dir/$name");
function in python to
upload a file to server? Kindly give me
answer.
regards
Prabahar
__
How much free photo storage do
Where I could find the TWAIN python interface ? I'm quite interested :)12 Jul 2005 08:44:49 -0700, Peter Herndon <[EMAIL PROTECTED]>:
"Document Management Software" is a little vague. What do you want itto do? In general though, when someone says "content management" and
"Python", the general res
[Fuzzy]
> There's a Python interface to TWAIN (the scanner protocol)
[Alexis]
> Where I could find the TWAIN python interface ?
Try typing "python twain" into Google. The first hit is:
http://twainmodule.sourceforge.net/
"The Python TWAIN module provides an interface to scanners, digital
Thomas Lotze wrote:
> AIUI (and as a little experimenting seems to confirm), you can't
> reposition an iterator over an mmap'ed file by seeking. True, you have
> both iterating by characters and seeking/telling, but the two
> functionalities don't play together.
A quick and dirty hack!? Maybe i'm
Roland Heiber wrote:
> class MmapWithSeekAndTell(object):
> def __init__(self, m, size):
.. where m is a mmap-object and size the filesize ... sorry.
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
I have written simple code using DocXMLRPCServer. How do I log method
name on the console after invoking registered
method on server. On the console it just prints message as [hostname -
date/time and "POST /RPC2 HTTP/1.0" 200 -]
code is:
from DocXMLRPCServer import DocXMLRPCServer
def T
Thank you2005/7/13, Richie Hindle <[EMAIL PROTECTED]>:
[Fuzzy]> There's a Python interface to TWAIN (the scanner protocol)[Alexis]> Where I could find the TWAIN python interface ?Try typing "python twain" into Google. The first hit is:
http://twainmodule.sourceforge.net/ "The Python TWAIN modul
Tim Peters <[EMAIL PROTECTED]> writes:
> [Michael Hudson]
> > I doubt anyone else is reading this by now, so I've trimmed quotes
> > fairly ruthlessly :)
>
> Damn -- there goes my best hope at learning how large a message gmail
> can handle before blowing up . OK, I'll cut even more.
Heh.
> [M
Hiho,
Having a string: "dothat"
and a tuple: (x, y)
1. What's the best way to build a function call like: dothat(x,y)?
Assuming dothat is def'd in the same module,
2. is: eval("dothat(x,y)", None, (('x', 100), ('y', 200)))
the right way to have it executed?
If dothat is def'd in another module:
All your **kwargs are belong to us.
*args is documented in the Tutorial. I reckon **kwargs represents a
dictionary of arguments. But I don't quite get the semantics of **x.
Undefined length tuple of undefined length tuples? Are there other
practical use cases for ** (common enough please, I wis
Francois De Serres wrote:
> Hiho,
>
> Having a string: "dothat"
> and a tuple: (x, y)
> 1. What's the best way to build a function call like: dothat(x,y)?
Not the best (not at all) but one way:
def dothat(x,y):
print "Called with:", x, y
c = (1,2)
locals().get("dothat")(*c)
Called wit
Francois De Serres wrote:
> All your **kwargs are belong to us.
>
> *args is documented in the Tutorial. I reckon **kwargs represents a
> dictionary of arguments. But I don't quite get the semantics of **x.
> Undefined length tuple of undefined length tuples? Are there other
> practical use cas
Roland Heiber wrote:
>Francois De Serres wrote:
>
>
>>Hiho,
>>
>>Having a string: "dothat"
>>and a tuple: (x, y)
>>1. What's the best way to build a function call like: dothat(x,y)?
>>
>>
>
>Not the best (not at all) but one way:
>
>
Still pretty interesting, thx.
>def dothat(x,y):
> pr
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
I'm interested in various metadata
extraction/prosessing/distribution/something tools(including ways of
differentiating between files, eg hashing etc) and especially python
enabled ones. I'm also considering content-recognition/differentiating
eg. imag
Roland Heiber wrote:
> Not the best (not at all) but one way:
>
> def dothat(x,y):
> print "Called with:", x, y
>
> c = (1,2)
>
> locals().get("dothat")(*c)
As you say, not the best, but in fact not really advisable under any
circumstances. locals() returns "module level" stuff only when ex
Francois De Serres wrote:
> All your **kwargs are belong to us.
>
> *args is documented in the Tutorial. I reckon **kwargs represents a
> dictionary of arguments. But I don't quite get the semantics of **x.
> Undefined length tuple of undefined length tuples? Are there other
> practical use cas
Francois De Serres wrote:
> Having a string: "dothat"
> and a tuple: (x, y)
> 1. What's the best way to build a function call like: dothat(x,y)?
>
> Assuming dothat is def'd in the same module,
> 2. is: eval("dothat(x,y)", None, (('x', 100), ('y', 200)))
> the right way to have it executed?
>
> I
Peter Hansen wrote:
> Francois De Serres wrote:
>
>> *args is documented in the Tutorial. I reckon **kwargs represents a
>> dictionary of arguments. But I don't quite get the semantics of **x.
>> Undefined length tuple of undefined length tuples? Are there other
>> practical use cases for ** (
praba kar enlightened us with:
> Is there any php equivalent move_uploaded_file($source_path,
> "$upload_dir/$name"); function in python to upload a file to server?
move_uploaded_file does NOT upload a file to a server.
> Kindly give me answer.
Kindly ask answerable question.
Sybren
--
The pro
Normally when I want to do what you describe I want to
do it for several functions not just a single one.
You can use a dictionary to hold the function names and
pointers to the functions themselves and then call them
by indexing into the dictionary. This works for me:
def dothat(x,y):
print
Jorey Bump wrote:
>
> Monty Python's Flying Circus used to begin with "It's..." I had read at one
> time that "It's" was one of the original names proposed for the
> troupe/show, although I can't seem to find verification.
"In fact, one of the titles of the show was 'It's', so he must have be
Peter Hansen wrote:
>Roland Heiber wrote:
>
>
>>Not the best (not at all) but one way:
>>
>>def dothat(x,y):
>> print "Called with:", x, y
>>
>>c = (1,2)
>>
>>locals().get("dothat")(*c)
>>
>>
>
>As you say, not the best, but in fact not really advisable under any
>circumstances. locals()
Duncan Booth wrote:
> Francois De Serres wrote:
>
>>Having a string: "dothat"
>>and a tuple: (x, y)
>>1. What's the best way to build a function call like: dothat(x,y)?
>>
>>Assuming dothat is def'd in the same module,
>>2. is: eval("dothat(x,y)", None, (('x', 100), ('y', 200)))
>>the right way to
Michael Hoffman wrote:
>Peter Hansen wrote:
>
>
>>Francois De Serres wrote:
>>
>>
>>
>
>
>
>>>*args is documented in the Tutorial. I reckon **kwargs represents a
>>>dictionary of arguments. But I don't quite get the semantics of **x.
>>>Undefined length tuple of undefined length tuples?
Hi all,
I am writing a script to visualize (and print)
the web references hidden in the html files as:
' underlined reference'
Optimizing my code, I found that an essential step is:
splitting on a word (in this case 'href').
I am asking if there is some alternative (more pythonic...):
# SplitMult
I ended up using this code to solve my problem.
> for a, b, c, d in s:
> if not query.has_key((a,b)): query[(a,b)] = []
>query[(a,b)].append("%s=%s" % (c, d))
> for (a,b), v in query.items():
>print a, b, ", ".join(v)
I'm relatively new to python/programming in general. I usually writ
Peter Hansen wrote:
>> locals().get("dothat")(*c)
This was just meant as a quick example, not as production-level code ;)
Even with globals(), I think its a bit odd ..., but safer than using
eval() ...
HtH, Roland
--
http://mail.python.org/mailman/listinfo/python-list
Francois De Serres wrote:
>Hiho,
>
>Having a string: "dothat"
>and a tuple: (x, y)
>1. What's the best way to build a function call like: dothat(x,y)?
>
>Assuming dothat is def'd in the same module,
>2. is: eval("dothat(x,y)", None, (('x', 100), ('y', 200)))
>the right way to have it executed?
>
>
[EMAIL PROTECTED] wrote:
> Hi all,
> I am writing a script to visualize (and print)
> the web references hidden in the html files as:
> ' underlined reference'
> Optimizing my code, I found that an essential step is:
> splitting on a word (in this case 'href').
>
> I am asking if there is some alt
On Wed, 13 Jul 2005 06:16:54 -0700, Robert Kern wrote:
> Duncan Booth wrote:
>> Francois De Serres wrote:
>>
>>>Having a string: "dothat"
>>>and a tuple: (x, y)
>>>1. What's the best way to build a function call like: dothat(x,y)?
[snip]
>> No, none of this is a good place to use eval.
[snip]
>>
Aloha,
Thomas Lotze wrote:
> I think I need an iterator over a string of characters pulling them out
> one by one, like a usual iterator over a str does. At the same time the
> thing should allow seeking and telling like a file-like object:
f = frankenstring("0123456789")
for c in f:
> ...
Francois De Serres wrote:
> Sorry, I was unclear about the fact that the args are formals. I'm
> trying to do something like:
>
> func = "dothat"
> args = ('x','y')
> localcontext = ()
> r = None
> while r is None:
> try:
> r = eval("dothat(x,y)", None, localcontext) #how do I constr
Steven D'Aprano wrote:
>On Wed, 13 Jul 2005 06:16:54 -0700, Robert Kern wrote:
>
>
>
>>Duncan Booth wrote:
>>
>>
>>>Francois De Serres wrote:
>>>
>>>
>>>
Having a string: "dothat"
and a tuple: (x, y)
1. What's the best way to build a function call like: dothat(x,y)?
Duncan Booth wrote:
>Francois De Serres wrote:
>
>
>
>>Sorry, I was unclear about the fact that the args are formals. I'm
>>trying to do something like:
>>
>>func = "dothat"
>>args = ('x','y')
>>localcontext = ()
>>r = None
>>while r is None:
>>try:
>>r = eval("dothat(x,y)", None, l
a good text indexer will help, look at lupy, pyndex, xapian etc
http://www.pypackage.org/packages/python-pyndex
http://www.divmod.org/Home/Projects/Lupy/
--
http://mail.python.org/mailman/listinfo/python-list
[rbt]
> What is the appropriate way to break out of this while loop if the for
> loop finds a match?
>
> while 1:
> for x in xrange(len(group)):
> try:
> mix = random.sample(group, x)
> make_string = ''.join(mix)
> n = md5.new(make_string)
>
On Wed, 13 Jul 2005 06:19:54 -0700, qwweeeit wrote:
> Hi all,
> I am writing a script to visualize (and print)
> the web references hidden in the html files as:
> ' underlined reference'
> Optimizing my code,
[red rag to bull]
Because it was too slow? Or just to prove what a macho programmer you
Requirement
==
A JAVA Server(RMI Sever) has to invoke some Python scripts.
These Python scripts in turn have to make some JAVA API calls. The JAVA APIs
will be provided by custom Java Classes and Interfaces.
I should be able to receive the "Output" from the Python script into my JAVA
se
Roland Heiber wrote:
> Even with globals(), I think its a bit odd ..., but safer than using
> eval() ...
Some would agree and claim that using an import is better:
c = (1, 2)
thisModule = __import__(__name__)
func = getattr(thisModule, 'dothat')
func(*c)
I don't generally find that more readabl
praba kar wrote:
> Is there any php equivalent
> move_uploaded_file($source_path, "$upload_dir/$name");
> function in python to
> upload a file to server?
As this is a Python forum, most will not know PHP. Perhaps describing
what you want in plain English would be more effective in getti
Say I have a list that has 3 letters in it:
['a', 'b', 'c']
I want to print all the possible 4 digit combinations of those 3
letters:
4^3 = 64
abaa
aaba
aaab
acaa
aaca
aaac
...
What is the most efficient way to do this?
--
http://mail.python.org/mailman/listinfo/python-list
Jacob Page wrote:
> Oye, there's quite a number of set and frozenset features that aren't
> well-documented that I now need to implement. What a fun chore!
It would be a great help if you could submit appropriate documentation
patches for the areas you don't think are well-documented:
http://s
Edvard Majakari wrote:
> Steven Bethard <[EMAIL PROTECTED]> writes:
>
>>$ python -m timeit "for x in (i for i in xrange(10)): y = x"
>>10 loops, best of 3: 4.75 usec per loop
>
> Yowza! One of the features I really liked in Perl has shored Python island
> somewhere in the 2.4'ies, it seems[1]
On Wed, 13 Jul 2005 10:21:19 -0400, rbt wrote:
> Say I have a list that has 3 letters in it:
>
> ['a', 'b', 'c']
>
> I want to print all the possible 4 digit combinations of those 3
> letters:
>
> 4^3 = 64
>
>
> abaa
> aaba
> aaab
> acaa
> aaca
> aaac
> ...
>
> What is the most efficient
i'll be straight with you and say that this is a homework assignment.
ive tried to figure it out on my own but am now out of time.
i need to go through a .txt file and get rid of all punctuation. also,
every time i see the work "Fruitloops=1" or "Hamburgers=x" where x is
ANY number i need to get
On Thu, 2005-07-14 at 00:47 +1000, Steven D'Aprano wrote:
> On Wed, 13 Jul 2005 10:21:19 -0400, rbt wrote:
>
> > Say I have a list that has 3 letters in it:
> >
> > ['a', 'b', 'c']
> >
> > I want to print all the possible 4 digit combinations of those 3
> > letters:
> >
> > 4^3 = 64
> >
> > aa
im looking for some advice regarding DNS lookup using python
is it possible to give parameters like the IP of a DNS server and the
DNS query to a python program and obtain the response from the DNS
server ?
please reply if u hav some idea or interest
laksh
--
http://mail.python.org/mailman/lis
hey, i have this huge text file and i need to go through and remove all
punctuation and every instance of the phrase "fruitloops=$" where $ is
any number 0-100" um, and yeah this is homework but i've tried to no
avail. thanks guys. cheerio :). jen
--
http://mail.python.org/mailman/listinfo/py
Use .replace function to replace punctuation (you didn't say
exactly what that means but just to get you started):
#
# Extend this list as needed
#
punctuations=',.;:()'
#
# Open input and output files
#
ifp=open(inputfilename,'r')
ofp=open(outputfilename,'w')
#
# Strip out the punctuation charact
On Wed, 2005-07-13 at 10:21 -0400, rbt wrote:
> Say I have a list that has 3 letters in it:
>
> ['a', 'b', 'c']
>
> I want to print all the possible 4 digit combinations of those 3
> letters:
>
> 4^3 = 64
>
>
> abaa
> aaba
> aaab
> acaa
> aaca
> aaac
> ...
>
> What is the most efficient w
On 13 Jul 2005 07:49:02 -0700, Michael Jordan <[EMAIL PROTECTED]> wrote:
> hey, i have this huge text file and i need to go through and remove all
> punctuation and every instance of the phrase "fruitloops=$" where $ is
> any number 0-100" um, and yeah this is homework but i've tried to no
> avail
George> What 'magic' ? The (x,y,z) notation is used only for 3D
George> vectors. (x,y) is also common for 2D and perhaps (t,x,y,z) for
George> 4D, with t for time.
Don't forget (w,x,y,z) for quaternions...
Skip
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 13 Jul 2005 10:39:41 -0400, rbt wrote:
>> > What is the most efficient way to do this?
>>
>> Efficient for who? The user? The programmer? The computer? Efficient use
>> of speed or memory or development time?
>
> The CPU
Ah, then that's easy. Sit down with pencil and paper, write out al
On 13 Jul 2005 07:44:41 -0700, laksh <[EMAIL PROTECTED]> wrote:
>im looking for some advice regarding DNS lookup using python
>
>is it possible to give parameters like the IP of a DNS server and the
>DNS query to a python program and obtain the response from the DNS
>server ?
>
Not using the built
On Wed, 2005-07-13 at 11:09 -0400, rbt wrote:
> On Wed, 2005-07-13 at 10:21 -0400, rbt wrote:
> > Say I have a list that has 3 letters in it:
> >
> > ['a', 'b', 'c']
> >
> > I want to print all the possible 4 digit combinations of those 3
> > letters:
> >
> > 4^3 = 64
> >
> >
> > abaa
> >
On Wed, 13 Jul 2005 11:09:25 -0400, rbt wrote:
> On Wed, 2005-07-13 at 10:21 -0400, rbt wrote:
>> Say I have a list that has 3 letters in it:
>>
>> ['a', 'b', 'c']
>>
>> I want to print all the possible 4 digit combinations of those 3
>> letters:
[snip]
> Expanding this to 4^4 (256) to test t
rbt wrote:
> On Wed, 2005-07-13 at 10:21 -0400, rbt wrote:
>
>>Say I have a list that has 3 letters in it:
>>
>>['a', 'b', 'c']
>>
>>I want to print all the possible 4 digit combinations of those 3
>>letters:
>>
>>4^3 = 64
>>
>>
>>abaa
>>aaba
>>aaab
>>acaa
>>aaca
>>aaac
>>...
>>
>>What is the
Francois De Serres wrote:
> Francois De Serres wrote:
>> Having a string: "dothat"
>> and a tuple: (x, y)
>> 1. What's the best way to build a function call like: dothat(x,y)?
>>
>> Assuming dothat is def'd in the same module,
>> 2. is: eval("dothat(x,y)", None, (('x', 100), ('y', 200)))
>> the rig
laksh wrote:
>
> is it possible to give parameters like the IP of a DNS server and the
> DNS query to a python program and obtain the response from the DNS
> server ?
http://pydns.sf.net
http://www.dnspython.org/
http://www.google.com/search?hl=en&q=python+dns&btnG=Google+Search
Ciao, Michael.
I'm trying to open a text file, remove all instances of the words
"f=x;" and "i=x;" where x can be any number 0-14. Also, I want to
remove all { " or ) or ( or ' } each time one of those characters
occurs respectively. This is what I've been able to piece together...
import os, string
x = (
rbt wrote:
> On Wed, 2005-07-13 at 11:09 -0400, rbt wrote:
>
>>On Wed, 2005-07-13 at 10:21 -0400, rbt wrote:
>>
>>>Say I have a list that has 3 letters in it:
>>>
>>>['a', 'b', 'c']
>>>
>>>I want to print all the possible 4 digit combinations of those 3
>>>letters:
>>>
>>>4^3 = 64
>>>
>>>
>>>a
Hopefully someone can catch what im missing here. Ive googled this and I think
Ive got the filetypes arg written properly, but I get a traceback when calling
this function.
Heres the code followed by its traceback.
def do_ask_fn_1():
z = askopenfilename(title=TITLE, initialdir=Dst_Dir,
rbt wrote:
> Expanding this to 4^4 (256) to test the random.sample function produces
> interesting results. It never finds more than 24 combinations out of the
> possible 256. This leads to the question... how 'random' is sample ;)
sample(population,k):
Return a k length list of unique element
Yes, there's a lot of issues, cross-site scripting, session hijacking,
proper authentication, etc. Open Web App Security Project is useful
www.owasp.org
Also, before you start with NLP and full-on parsers, think about if you
can apply a text indexer, stemming and stopping both your user's
queri
I have an executable
version of a script that I wrote, but my script and backups got erased. Is
it possible to get the python script back from an exe file created with
py2exe?
Joe Woodward
Phoenix Analysis & Design
Technologies
7755 s. Research Drive - Suite
110
Tempe, Arizona 85284
(480
On Wed, Jul 13, 2005 at 05:07:33PM +0100, Duncan Smith wrote:
> rbt wrote:
> > On Wed, 2005-07-13 at 11:09 -0400, rbt wrote:
> >
> >>On Wed, 2005-07-13 at 10:21 -0400, rbt wrote:
> >>
> >>>Say I have a list that has 3 letters in it:
> >>>
> >>>['a', 'b', 'c']
> >>>
> >>>I want to print all the pos
Hi, I'm trying to use the AddPrinterDriver method of
Win32_PrinterDriver to create a new. print driver. I can't get my
head round how I need to do this. So far I have
import win32com.client
WBEM =
win32com.client.GetObject(r"winmgmts:{impersonationLevel=impersonate}!\\"
+ "." + r"\root\cimv2
Jack Diederich wrote:
> On Wed, Jul 13, 2005 at 05:07:33PM +0100, Duncan Smith wrote:
>
>>rbt wrote:
>>
>>>On Wed, 2005-07-13 at 11:09 -0400, rbt wrote:
>>>
>>>
On Wed, 2005-07-13 at 10:21 -0400, rbt wrote:
>Say I have a list that has 3 letters in it:
>
>['a', 'b', 'c']
>
On Wed, 2005-07-13 at 09:00 -0700, [EMAIL PROTECTED] wrote:
> I'm trying to open a text file, remove all instances of the words
> "f=x;" and "i=x;" where x can be any number 0-14. Also, I want to
> remove all { " or ) or ( or ' } each time one of those characters
> occurs respectively. This
For me this:
z = tkFileDialog.askopenfilename(title='Title',
filetypes=[
('AIFF Files','*.aiff'),
("TXT Files", "*.txt"),
],
i
Jeremy Sanders wrote:
> fargo wrote:
>
>
>>I'm looking for some way to sort files by date.
>
>
> you could do something like:
>
> l = [(os.stat(i).st_mtime, i) for i in glob.glob('*')]
> l.sort()
> files = [i[1] for i in l]
>
> Jeremy
>
If you have 2.4 or later:
def mtime(filename):
Scott David Daniels wrote:
>Francois De Serres wrote:
>
>
>>Francois De Serres wrote:
>>
>>
>>>Having a string: "dothat"
>>>and a tuple: (x, y)
>>>1. What's the best way to build a function call like: dothat(x,y)?
>>>
>>>Assuming dothat is def'd in the same module,
>>>2. is: eval("dothat(x,y
Thomas Lotze wrote:
> Peter Otten wrote:
>
> class frankenstring(StringIO):
>> ... def next(self):
>> ... c = self.read(1)
>> ... if not c:
>> ... raise StopIteration
>> ... return c
>
> Repeated read(1) on a file-like object is one
SDXF is a Python library to generate DXF files. DXF is an abbreviation
of Data Exchange File, a vector graphics file format. It is supported
by virtually all CAD products (such as AutoCAD, Blender, 3Dstudio,
Maya,Vectorworks...) and vector drawing programs (such as Illustrator,
Flash, ...).
SDXF c
Scott David Daniels wrote:
> iter(elem in lst if elem[3] == x).next()
>
> Does this look any better? At least it stops when the answer is found.
Next time you'll recommend
if (a>b) == True:
# ...
Watch out, you're on a slippery slope here :-)
Peter
--
http://mail.python.org/mailman/li
Ric Da Force <[EMAIL PROTECTED]> wrote:
> I have a string such as 'C1, C2, C3'. Without assuming that each bit of
> text is of fixed size, what is the easiest way to change this list so that
> it reads:
> 'C1, C2 and C3' regardless of the length of the string.
>>> import re
>>> data = "the fir
I have the executable of a script that I wrote, that has been erased.
Is there any way to retrieve the uncompiled python script from the
executable that was created with py2exe?
Thank you,
Joe
--
http://mail.python.org/mailman/listinfo/python-list
You probably need to remove the SpawnInstance_() call.
An abstract WMI class as returned by WBEM.Get should work
for the DriverInfo parm, since the concrete Win32_PrinterDriver
instance is what the AddPrinterDriver call is trying to create.
hth
Roger
<[EMAIL PROTECTED]> wrote in messa
"rbt" <[EMAIL PROTECTED]> wrote:
> Say I have a list that has 3 letters in it:
>
> ['a', 'b', 'c']
>
> I want to print all the possible 4 digit combinations of those 3
> letters:
>
> 4^3 = 64
It's actually 3^4 = 81 (3 candidates/choice ** 4 choices)
>
> abaa
> aaba
> aaab
> acaa
> aaca
> a
Hi,
> for punctuation in punctuations:
> line=line.replace(punctuation,'')
I would use maketrans or even a regex instead. However, If you care
about speed, it is well known that in some cases regex take more
time than multiple replaces. Even the maketrans could take more time
(I don't
QOTW: "The posts do share an erroneous, implied assumption that the
investment in learning each language is equal. Python has a strong
competitive advantage over Java and C++ in terms of learnability. A
person can get up to speed in a few days with Python." - Raymond Hettinger
"You know, this is
reverse dns lookup is not really special compared to a regular dns lookup.
you just need to look up a special name:
http://www.dnsstuff.com/info/revdns.htm
to format the ip address properly use something like:
def rev_dns_string(ip_str):
nums = ip_str.split('.').reverse()
nums.extend(('in-
1 - 100 of 170 matches
Mail list logo