On Jul 2, 5:22 pm, Nathan Harmston [EMAIL PROTECTED]
wrote:
Hi,
I m sorry but I m bored at work (and no ones looking so I can write
some Python) and following a job advertisement post,I decided to write
the code to do its for the one entitled Ninjas or something like that.
I was wondering
On Jun 27, 2:42 pm, Matthew Peter [EMAIL PROTECTED] wrote:
Is it possible to print the function calls to a module? Like:
test.py
import mymod
print mymod.x()
mymod.py
# each time a function is called we print out the called function and module
print 'Func call: %s from %s' % (???, ???)
On Jun 26, 8:04 am, vj [EMAIL PROTECTED] wrote:
I have a perl script which connect to network stream using sockets.
The scripts first logins in to the server and then parses the data
comming from the socket.
Statement 1:
my $today = sprintf(%4s%02s%02s, [localtime()]-[5]+1900,
On Jun 26, 8:59 am, [EMAIL PROTECTED] wrote:
(snipped)
def bcdlen(*args):
... strlen = %04s % str(args[0])
... firstval = int(strlen[2:3]) * 16 + int(strlen[3:4])
... lastval = int(strlen[0:1]) * 16 + int(strlen[1:2])
... return %s%s % (chr(firstval), chr(lastval))
...
On Jun 25, 2:41 pm, oscartheduck [EMAIL PROTECTED] wrote:
I eventually went with:
#!/usr/bin/env python
from PIL import Image
import glob, os, re
size = 128, 128
def thumbnailer(dir, filenameRx):
for picture in [ p for p in os.listdir(dir) if
os.path.isfile(os.path.join(
dir,p))
On Jun 22, 2:44 pm, John Henry [EMAIL PROTECTED] wrote:
On Jun 22, 2:28 pm, askel [EMAIL PROTECTED] wrote:
(snipped)
The above doesn't exactly do I what need. I was looking for a way to
add method to a class at run time.
I'm not sure what you mean by this. Bind an attribute -- a method
On Jun 22, 3:53 pm, johnny [EMAIL PROTECTED] wrote:
Scope of ids:
When I print ids, it's always empty string '', as I have intialized
before. That's not what I want. I want the ids to have
str(r['id']).join(',')
if res:
ids = ''
for r in res['key']:
On Jun 19, 6:34 pm, [EMAIL PROTECTED] wrote:
Greetings,
I have been working on a little project today to help me better
understand classes in Python (I really like Python). I am a self
taught programmer and consider myself to fall in the beginner
category for sure. It was initially sparked
On Jun 3, 5:23 pm, Shihpin [EMAIL PROTECTED] wrote:
Hi all,
Is there a fuction that reverse the digits of a number?
Many thanks,
Shihpin Lin
One can use int, str and a slice:
print int(str(40286)[::-1])
--
Hope this helps,
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On May 30, 10:11 pm, theju [EMAIL PROTECTED] wrote:
Hello all,
I've two objects (both instances of a class called Person) and I want
to use the __and__ method and print the combined attributes of the two
instances.
To be precise, here is my code
class Person:
def
On May 21, 11:02 pm, Steven Bethard [EMAIL PROTECTED] wrote:
I have some text and a list of Element objects and their offsets, e.g.::
text = 'aaa aaa aaabbb bbbaaa'
spans = [
... (etree.Element('a'), 0, 21),
... (etree.Element('b'), 11, 18),
...
On May 21, 11:02 pm, Steven Bethard [EMAIL PROTECTED] wrote:
I have some text and a list of Element objects and their offsets, e.g.::
text = 'aaa aaa aaabbb bbbaaa'
spans = [
... (etree.Element('a'), 0, 21),
... (etree.Element('b'), 11, 18),
...
On May 11, 3:44 pm, dmitrey [EMAIL PROTECTED] wrote:
hi all,
does anyone know howto set title of whole window? (I mean not just
area above plot but string in the same line where buttons 'close',
'iconify', 'fullscreen' are situated)
Use coordinates to set a title for the current figure.
On May 9, 11:33 am, Bjoern Schliessmann usenet-
[EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] wrote:
class longList(shortList):
def __init__(self):
shortList.setList()
self.setList()
Addition: Always call the base class __init__ in your constructor if
there exists
On May 2, 1:35 pm, [EMAIL PROTECTED] wrote:
How to check if a string is empty in python?
if(s == ) ??
Empty strings and containers are false; so
one can write
if (not s):
print something...
--
Hope this helps,
Steven
--
http://mail.python.org/mailman/listinfo/python-list
On May 1, 10:12 am, 7stud [EMAIL PROTECTED] wrote:
On May 1, 4:08 am, Daniel Nogradi [EMAIL PROTECTED] wrote:
Does sqlite come in a mac version?
The interface (pysqlite) is part of the python 2.5 standard library
but you need to install sqlite itself separately (as far as I
remember)
On Apr 28, 6:37 am, Bart [EMAIL PROTECTED] wrote:
Hi everyone!
Im using module that gives errors to stderr/stdout (generated by SWIG)
Problem is that I need to parse this errors/information from module.
os.popen3 looks nice but this executes command not function.
Is there any solution?
On Apr 22, 6:55 am, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Is anyone aware of python library that does function minimization a la
Minuit (http://wwwasdoc.web.cern.ch/wwwasdoc/minuit/) used by CERN?
thanks
If you have a C complier and the lapack, blas, and levmar
libraries, you could try
On Apr 21, 5:58 am, Dustan [EMAIL PROTECTED] wrote:
From my searches here, there is no equivalent to java's
StringTokenizer in python, which seems like a real shame to me.
However, str.split() works just as well, except for the fact that it
creates it all at one go. I suggest an itersplit be
On Apr 19, 9:13 am, Anton Vredegoor [EMAIL PROTECTED] wrote:
(snipped)
How about this one?
No that can result in an infinite loop after yet another
print it1.next()
This one however ...
from collections import deque
class sentinel(object):
pass
class myiter(object):
On Apr 19, 3:37 pm, Anton Vredegoor [EMAIL PROTECTED] wrote:
Anton Vredegoor wrote:
Maybe this one is better?
No, this one keeps generating output.
But this one stops at least:
from collections import deque
from itertools import chain, repeat
def xsplitter(seq, pred):
Q =
On Apr 17, 3:52 pm, [EMAIL PROTECTED] wrote:
(snipped)
So far I haven't succed using the coroutine Python 2.5 allows using
the generators, and I think still that xsplitter can be done with two
coroutines instead of two It objects. Despite Steven's code I am
unable still to write a working
On Apr 18, 12:23 pm, Anton Vredegoor [EMAIL PROTECTED]
wrote:
(snipped)
But still, the 'while True:' loop and the 'try-except' clause and the
explicit StopIteration are not necessary ...
from collections import deque
def xsplitter(seq, pred):
Q = deque(),deque()
it = iter(seq)
On Apr 16, 5:14 pm, [EMAIL PROTECTED] wrote:
Once in while I too have something to ask. This is a little problem
that comes from a Scheme Book (I have left this thread because this
post contains too much Python code for a Scheme
On Apr 16, 10:18 am, [EMAIL PROTECTED] wrote:
Matt from time import mktime
Matt def secondsInMonth(year, month):
Matt s1 = mktime((year,month,1,0,0,0,0,0,-1))
Matt s2 = mktime((year,month+1,1,0,0,0,0,0,-1))
Matt return s2-s1
Probably won't work if month==12.
On Apr 16, 3:13 pm, john [EMAIL PROTECTED] wrote:
All:
Hi. I am an experienced developer (15 yrs), but new to Python and have
a question re unittest and assertRaises. No matter what I raise,
assertRaises is never successful. Here is the test code:
class Foo:
def testException(self):
On Apr 16, 6:05 pm, [EMAIL PROTECTED] wrote:
hi
i have a list (after reading from a file), say
data = [ 'a','b','c','d','a','b','e','d']
I wanted to insert a word after every 'a', and before every 'd'. so i
use enumerate this list:
for num,item in enumerate(data):
if a in item:
On Apr 12, 9:20 am, Paulo da Silva [EMAIL PROTECTED] wrote:
Hi!
I need to process a file to produce another file that *must* have
*exactly* the same attributes and permissions of the former. What is the
best way to do this? The file must not exist with contents (it may exist
empty) unless it
On Apr 12, 4:09 pm, Paulo da Silva [EMAIL PROTECTED] wrote:
[EMAIL PROTECTED] escreveu:
On Apr 12, 9:20 am, Paulo da Silva [EMAIL PROTECTED] wrote:
Hi!
I need to process a file to produce another file that *must* have
*exactly* the same attributes and permissions of the former. What
On Apr 12, 5:19 pm, [EMAIL PROTECTED] wrote:
On Apr 12, 4:09 pm, Paulo da Silva [EMAIL PROTECTED] wrote:
(snipped)
import subprocess
retcode = subprocess.call([ /bin/cp, -p, oldfile, newfile ])
On my system, this preserves the access permissions and ownership.
And if you modify the file
On Apr 11, 9:50 pm, Gabriel Genellina [EMAIL PROTECTED]
wrote:
En Wed, 11 Apr 2007 23:14:01 -0300, Qilong Ren [EMAIL PROTECTED]
escribió:
Thanks for reply. That actually is not what I want. Strings I am dealing
with may look like this:
s = 'a = 4.5 b = 'h' 'd' c = 4.5 3.5'
What I
On Apr 6, 1:48 pm, [EMAIL PROTECTED] wrote:
(snipped)
If I look in the MS Access database, I see the timestamp as 5/6/112.
Obviously some user didn't enter the correct date and the programmer
before me didn't give Access strict enough rules to block bad dates.
How do I test for a malformed
On Apr 4, 7:43 pm, [EMAIL PROTECTED] (Alex Martelli) wrote:
(snipped)
A we-don't-need-no-stinkin'-one-liners more relaxed approach:
import collections
d = collections.defaultdict(int)
for x in myList: d[x] += 1
list(x for x in myList if d[x]==1)
yields O(N) performance (give that
On Apr 5, 2:08 pm, Steven W. Orr [EMAIL PROTECTED] wrote:
I have a tuple that I got from struct.unpack. Now I want to pass the data
from the returned tuple to struct.pack
fmt
'l 10l 11i h 4h c 47c 0l'struct.pack(fmt, tup)
Traceback (most recent call last):
File stdin, line 1, in ?
On Apr 5, 2:13 pm, Martin Manns [EMAIL PROTECTED] wrote:
On Thu, 5 Apr 2007 16:55:38 -0400
John Clark [EMAIL PROTECTED] wrote:
That works, but when I replace A with something else, I do not get
the
grandparent anymore
without changing all the method calls. Basically, I would like to
On Apr 4, 12:22 pm, [EMAIL PROTECTED] wrote:
Hello, I have been trying to call the super constructor from my
derived class but its not working as expected. See the code:
class HTMLMain:
def __init__(self):
self.text = HTMLBODY;
print(self.text);
def __del__(self):
On Apr 4, 3:19 pm, Scott [EMAIL PROTECTED] wrote:
(snipped)
print
print ' ' * left_margin + '+' + '-' * (box_width-2) + '+'
print ' ' * left_margin + '| ' + ' ' * text_width + ' |'
print ' ' * left_margin + '| ' + ' ' sentence + ' |'
print ' ' * left_margin + '| ' + ' '
On Apr 1, 1:38 pm, Rehceb Rotkiv [EMAIL PROTECTED] wrote:
In the re documentation, it says that the matching functions return non-
overlapping matches only, but I also need overlapping ones. Does anyone
know how this can be done?
Perhaps lookahead assertions are what you're
looking for?
On Mar 31, 6:42 am, Rehceb Rotkiv [EMAIL PROTECTED] wrote:
(snipped)
As each line consists of 5 words, I would break up the data into an array
of five-field-arrays (Would you use lists or tuples or a combination in
Python?). The word BUT would be in the middle, with two fields/words
left and
On Mar 29, 7:22 am, aspineux [EMAIL PROTECTED] wrote:
I want to parse
'[EMAIL PROTECTED]' or '[EMAIL PROTECTED]' and get the email address [EMAIL
PROTECTED]
the regex is
r'[EMAIL PROTECTED]|[EMAIL PROTECTED]'
now, I want to give it a name
r'(?Pemail[EMAIL PROTECTED])|(?Pemail[EMAIL
On Mar 28, 1:44 pm, [EMAIL PROTECTED] wrote:
Hi everyone.
I'm trying to work with very simple data structures but I'm stuck in the very
first steps. If someone has the luxury of a few minutes and can give an
advice how to resolve this, I'll really appreciate it.
1- I have a list of tuples
On Mar 29, 6:05 am, greg [EMAIL PROTECTED] wrote:
In my quest to eliminate C compiler warnings from
Pyrex output, I've discovered some utterly bizarre
behaviour from gcc 3.3.
The following code:
void g(struct foo *x) {
}
void f(void) {
void (*h)(struct foo *);
h = g;
On Mar 25, 3:36 pm, ianaré [EMAIL PROTECTED] wrote:
yeah the subject doesn't really make sense does it?
anyway want I want to do is this:
if n == 1:
self.operations.insert(pos, operations.Replace.Panel(self, main))
elif n == 2:
self.operations.insert(pos,
On Mar 20, 12:53 pm, Mr Pekka Niiranen [EMAIL PROTECTED]
wrote:
Hi,
is it possible to get the two annual daylight saving times
(day, month and time) from Python by giving location
in some country/location string (Europe/Finland for example).
I need to ask country in program and calculate
On Mar 19, 10:33 pm, [EMAIL PROTECTED] wrote:
hi
how can i use regexp to group these digits into groups of 3?
eg
line 123456789123456789
i have :
pat = re.compile(line\s+(\d{3}) , re.M|re.DOTALL)
but this only gives the first 3. I also tried
line\s+(\d{3})+
but also not working.
I
On Mar 14, 1:14 pm, Darren Dale [EMAIL PROTECTED] wrote:
Does anyone know if it is possible to represent a number as a string with
engineering notation (like scientific notation, but with 10 raised to
multiples of 3: 120e3, 12e-6, etc.). I know this is possible with the
decimal.Decimal class,
On Mar 13, 5:57 am, Gerard Flanagan [EMAIL PROTECTED] wrote:
Hello,
I have a third party shell script which updates multiple environment
values, and I want to investigate (and ultimately capture to python)
the environment state after the script has run. But running the script
as a child
On Mar 12, 10:01 am, Erik Johnson [EMAIL PROTECTED] wrote:
Sorry, I forgot to paste the modified version of my code in the post:. I
think this is the same behaviour:
for line in lines:
if placed in line:
if i_a/i_b/ROM/ in line:
pos = (line.split()[4]).split(_)[1]
On Mar 12, 4:26 pm, Paulo da Silva [EMAIL PROTECTED] wrote:
Hi.
I have just seen that csv module, more exactly the Dialect class,
does not have any variable to specify the floating point character!
In portuguese this is ','. Not '.'. 3.1415 - 3,1415.
I think this is also the case of other
On Mar 8, 10:35 am, [EMAIL PROTECTED] wrote:
(snipped)
Ok, regex was my first thought because I used to use grep with Perl
and shell scripting to grab everything from one pattern to another
pattern. The file is just an unformatted file. What is below is
exactly what is in the file. There
On Mar 2, 2:44 pm, Shawn Milo [EMAIL PROTECTED] wrote:
(snipped)
I'm attaching both the Perl and Python versions, and I'm open to
comments on either. The script reads a file from standard input and
finds the best record for each unique ID (piid). The best is defined
as follows: The newest
On Mar 2, 7:02 am, John Henry [EMAIL PROTECTED] wrote:
On Mar 1, 10:07 pm, John Henry [EMAIL PROTECTED] wrote:
On Mar 1, 9:53 pm, [EMAIL PROTECTED] wrote:
(snipped)
You can try adjusting the labels and ticks
using matplotlib.ticker.
To the example you cited, one can add
from
On Mar 1, 3:10 pm, John Henry [EMAIL PROTECTED] wrote:
I've been asking this question at the matplotlib user list and never
gotten an answer. I am hoping that there are matplotlib users here
that can help.
My problem with matplotlib's way of handling axes label is illustrated
by this
On Feb 28, 12:40 pm, [EMAIL PROTECTED] wrote:
I'm a bit embarrassed to have to ask for help on this, but I'm not finding
the solution in the docs I have here.
Data are assembled for writing to a database table. A representative tuple
looks like this:
('eco', (u'Roads',),
On Feb 28, 4:06 pm, Ryan K [EMAIL PROTECTED] wrote:
I'm trying to text wrap a string but not using the textwrap module. I
have 24x9 matrix and the string needs to be text wrapped according
to those dimensions. Is there a known algorithm for this? Maybe some
kind of regular expression? I'm
On Feb 28, 5:50 pm, Ryan K [EMAIL PROTECTED] wrote:
On Feb 28, 8:27 pm, [EMAIL PROTECTED] wrote:
Try:
import re
sample_text = Personal firewall software may warn about the
connection IDLE makes to its subprocess using this computer's internal
loopback interface. This connection is
On Feb 26, 5:43 pm, Venky [EMAIL PROTECTED] wrote:
Hi,
I am trying to create classes at runtime based on input from a textfile.
I am trying to use the function new.classobj. I am able to create the
new classes successfully, however I fail to understand on how to add
this new class to the
On Feb 25, 5:12 pm, [EMAIL PROTECTED] wrote:
consider the following working loop where Packet is a subclass of
list, with Packet.insert(index, iterable) inserting each item in
iterable into Packet at consecutive indexes starting at index.
i=0
while(ilen(packet)-4):
if
On Feb 21, 6:17 pm, [EMAIL PROTECTED] wrote:
Following python code prints out incorrect UTC Offset - the python
docs say that %z is not fully supported on all platforms - but on
Linux Fedora FC5, perl code works and python does not - is this a bug
or is this expected behavior? For a EST
On Feb 12, 8:03 pm, jairodsl [EMAIL PROTECTED] wrote:
Hello everybody !
I have two list, they are, S1=['A','B','C','D','E'], and
S2=['F','G','H','I','J'], but i have to compare both in this way:
A vs J
A vs I, B vs J
A vs H, B vs I, C
On Feb 11, 5:13 am, Samuel Karl Peterson
[EMAIL PROTECTED] wrote:
Johny [EMAIL PROTECTED] on 10 Feb 2007 05:29:23 -0800 didst step
forth and proclaim thus:
I need to find all the same words in a text .
What would be the best idea to do that?
I make no claims of this being the best
On Feb 8, 8:28 am, Johny [EMAIL PROTECTED] wrote:
Playing a little more with strings, I found out that string.find
function provides the position of
the first occurance of the substring in the string.
Is there a way how to find out all substring's position ?
To explain more,
let's suppose
Daniel Nogradi wrote:
I have a program that keeps some of its data in a list of tuples.
Sometimes, I want to be able to find that data out of the list. Here is
the list in question:
[('password01', 'unk'), ('host', 'dragonstone.org'), ('port', '1234'),
('character01', 'Thessalus')]
Schüle Daniel wrote:
(snipped)
I am trying to construct a case where a greedy and
non greedy operation produce different result.
I dont see the difference between 'a??b' and 'a?b'
As far I understand is that ? will first try to match a
(it's greedy) and only if it fails then it step back
Ivan Vinogradov wrote:
Dear All,
I would greatly appreciate a nudge in the right direction concerning
the use of cwd argument in the call function from subprocess module.
The setup is as follows:
driver.py - python script
core/ - directory
main
65 matches
Mail list logo