than the IBM mag-card system I started with,
itself a step up from single use punch cards...
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
millions of file entries in a directory. If a filesystem based
answer is sought, I'd consider generating 16-bit CRCs per key and
appending the keys to the CRC named file, then pass those, sort and do
the final counting.
Emile
___
Tutor mai
und returns an empty string."
HTH,
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
se of self paired words
that aren't pairs. (pop,wow,mom,etc)
I got 94 distinct pairs. Which is a better result than the 124.5 pairs
I got the first pass through.
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscriptio
On 12/23/2013 07:11 AM, Steven D'Aprano wrote:
Are you now even a
*tiny* bit moved to use a single space after full stops?)
No. See http://www.heracliteanriver.com/?p=324
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or c
be aware that it could impact other parts
of your porgram as well, particularly if this is a read in data set from
a non-local region. Also, in places where commas are used as decimal
points, it's also common to use periods as commas:
>>> print
e's python
distribution which includes Mark Hammond's windows extensions. Then
read through the docs on com servers. It's been a while since I've done
so, but I expect that should get you going.
Emile
___
Tutor maillist - Tutor@pytho
than running the program
I presume there is no way around this.
Autocompletion is provided by the editor you're using. You'll need to
place some more context around this question to get appropriate responses.
Emile
___
Tutor maillist - T
, 09:35:42)
[GCC 2.96 2731 (Red Hat Linux 7.1 2.96-85)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys as s
>>> m = s
>>> id(m)
1075446500
>>>
13:47:21)
[GCC 3.2.2 20030222 (Red Hat Linux 3.2.2-5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> a100 = list(range(100))
>>> a100[::10]
[0, 10, 20, 30, 40, 50, 60, 70, 80, 90]
>>>
HTH,
On 08/08/2014 01:50 AM, Greg Markham wrote:
die_1 = """
.-.
| |
| o |
| |
`-'"""
die_2 = """
.-.
|o|
| |
|o|
`-'"""
I'll leave the cleanup as an exercise for you.
HTH,
Emile
On 08/08/2014 10:58 AM, emile wrote:
On 08/08/2014 01:50 AM, Greg Markham wrote:
die_1 = """
.-.
| |
| o |
| |
`-'"""
die_2 = """
.-.
|o|
| |
|o|
`-'"""
Not quite sure how this
e I would need to get out of the
loop.
How about (untested):
additionalLines = 3
remainingLines = 0
for line in file:
if 'NEW' in line or remainingLines:
mylist.append(line)
if not remainingLines:
remainingLines = additionalLines
else:
remainingLines -= 1
n and save the trouble, or
do AI need a witchdoctor here?
Also consider that closing a connection before the buffer is fully
flushed can cause loss of data.
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription opt
plest possible one.]
So, how does python do this?
Start here...
http://effbot.org/zone/python-hash.htm
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
98e86c1fd/884359798ce1e025?q=python+imaplib+delete+message)
Emile
What am I missing?
Bill
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
ii::sizeW+1][:ln])
result.append(FpuzzleLayout[ii::sizeW+1][:ln])
# now add in the reversed results
for ii in result[:]:
result.append("".join(reversed(ii)))
# and the corners
result.extend([puzzleLayout[0],
puzzleLayout[-1],
FpuzzleLayout[0],
duler from www.mjtnet.com just
for the windows automation tasks I run into (scripted from within python).
There's also http://pypi.python.org/pypi/SendKeys/0.3, but at this point
if I were to start over I'd look closely at
http://www.rutherfurd.net/python/sen
On 3/17/2010 8:02 AM Karjer Jdfjdf said...
I'm having problems with iterations and loops. So I'm curious about the best
Python-way to do iterations of lists (in if, while etc statements) and breaking
of loops.
I have a list of tuples with 2 values. I want to perform calculations on all of
the
On 3/17/2010 11:02 PM sitharak said...
I tried this statement to store in RDF form
This is too specialized for this list. I couldn't find a dedicated news
group for this project, but there is an IRC support channel -- see
http://en.wikipedia.org/wiki/RDFLib#Support
HTH,
Emile
On 3/19/2010 9:41 AM James Reynolds said...
OK, so starting here:
def mcrange_gen(self, sample):
lensample = len(sample)
nx2 = self.nx1
nx2_append = nx2.append
nx2_sort = nx2.sort
nx2_reverse = nx2.reverse
nx2_index = nx2.index
nx2_remove = nx2.remove
for s in ra
;>
Comments?
Version specific variations of packages with dedicated mailing lists are
likely beyond the scope of this group. I'd ask on the numpy list.
See http://www.scipy.org/Mailing_Lists
Emile
--
Wayne Watson (Watson Adventures, Prop., Nevada City, CA)
(12
/usr/local/bin/myscript.py
and change cron to
* * * * * someone /usr/local/bin/myscript.sh
and see if that helps.
Emile
Error in sys.exitfunc:
Traceback (most recent call last):
File "/usr/lib/python2.6/atexit.py", line 24, in _run_exitfuncs
func(*targs, **kargs)
File "/usr/l
On 3/28/2010 8:44 AM kevin parks said...
okay. I got the subprocess bit to work and i have os walk doing its walk. But
now for something i did not think about until i started to think about how to
fit these two bits to work together.
os walk is going to traverse my dirs from some given startin
nctions you may find helpful:
>>> os.path.split(sourcefile)
('/home/someone/somedir', 'foo01.aif')
>>> os.path.basename(sourcefile)
'foo01.aif'
>>> os.path.splitext(sourcefile)
('/home/someone/somedir/foo01', '.aif')
>>>
cking http://pypi.python.org/pypi/setuptools I see links to the list
at http://mail.python.org/pipermail/distutils-sig/
Those are the guys that will want this info and will most likely help
you work through it.
HTH,
Emile
I have taken the following steps already:
1. My path is set
You're almost there it seems.
HTH,
Emile
>
>
> I don't know what kind of translated output he need. I guess:
>
> 1. the name of the file containing the translated output is *
> storyAmer.txt* and it is to located in a subdirectory off your cset1100py
>
uot;ent"
print newstr
But the system said TypeError: 'type' object is unsubscriptable
What's wrong?
str is an unfortunate variable name choice -- try oldstr instead. What
you've done is often called shadowing. I don't get the error her
On 3/30/2010 8:23 AM Mike Baker said...
Random Googling shows that there are things like process identification
numbers available - such as proc.pid. How do I find the other options?
try dir(proc) or help(proc) for starters...
Emile
___
Tutor
"""
def __init__(self,name):
print "A new critter has been born!"
self.name = name
def talk(self):
print "\nHi. I'm %s, an instance of class Critter." % self.name
# main
crit1 = Critter('Polly&
x27;t work...
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
sting system. FTP
is essentially a file transfer protocol designed and inteded to move
data between systems.
If what you're asking for is essentially how to do a cp (or copy on
win??) from a remote machine you may want to look at "scp - secure copy
(remote file copy program)
dig into the spambayes code -- see
http://spambayes.sourceforge.net/
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
) as whole
numbers and only convert upon presentation and your calculations will
always be accurate for the source measurements taken.
In accounting systems I've always keep dollar amounts in whole pennies
for this same reason.
Emile
___
10)
d = dict(zip(a,a))
5 in d
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On 4/23/2010 2:21 PM Alan Gauld said...
"Emile van Sebille" wrote
It's expensive enough that for a list this size I'd convert it to a
dict and use in on that. eg,
a = range(10)
d = dict(zip(a,a))
Surely that would depend on how often you do the search? If its a o
list 1/10th the size is a typo?
Anyway, I think we're all on the same page.
Nice benchmarks, btw.
Regards,
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
r261:67515, Dec 5 2008, 13:58:38) [MSC v.1500 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> def sqrt(x): return x**.5
...
>>> sqrt(4)
2.0
>>> sqrt(12)
3.4641016151377544
t a correct statement.
It wasn't the omitted case that exhibits the difference. When
sub-classing, any methods omitted defer to the parent's version so the
init from the dict parent happened.
Emile
___
Tutor maillist - Tutor@python.org
On 4/28/2010 9:32 AM Walter Wefft said...
Emile van Sebille wrote:
On 4/28/2010 3:20 AM Walter Wefft said...
You reiterate my point. To say that dict.__init__ can be omitted in a
subclass's __init__ with no effect, is not a correct statement.
It wasn't the omitted case that ex
es of issues after
being bitten.
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
x27;d need the code for getLeaves, which isn't here. It
must have been provided to you somewhere...
Emile
getLeaves ( jenny )
[5,3,0,9]
getLeaves ( joshua )
[15,17,19,11,13]
I know its really simple, but I'm really new to this
On 6/3/2010 8:50 AM Tino Dai said...
Hi All,
Is there a way to express this:
isThumbnail = False
if size == "thumbnail":
isThumbnail = True
like this:
[ isThumbnail = True if size == "thumbnail" isThumbnail = False ]
and the scoping extending to one lev
ttle off the
one-liners as part of the original coding effort, and only break it out
when there's a need to -- I'm not striving to compact things into
one-liners.
BTW, doesn't
dict(map(lambda x: (str(x[1]),x[0]),map(lambda
ible to recover the lost data, and I've a fair amount of
experience recovering lost data even from unmountable partitions and
drives that don't power up.
I'm not opposed to the idea so I think I'd try it out, but those are
issues I'd watch for.
Emile
_
time.sleep(n - (time.time()-start))
Watch out for this -- you may want to do
time.sleep(n - max(0,(time.time()-start)))
to avoid passing sleep a negative number which causes the big sleep...
Emile
___
Tutor maillist - Tutor@python.org
To unsubsc
ither put hash marks in or
leave the blank lines out...
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On 6/25/2010 9:08 AM Steve Willoughby said...
On 25-Jun-10 08:23, Emile van Sebille wrote:
On 6/25/2010 1:33 AM ALAN GAULD said...
Copy and pasting is a PITA.
Why would you want to copy and paste?
Because it makes it easy to work on code. My preferred editor (TextPad)
allows block
nto filter will always result in [] (so a is always false) and
will thereby cause the else clause never to be reached.
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On 7/5/2010 4:19 PM Alan Gauld said...
But for the specific case of file extensions the os.path.splitext() is
a better solution.
If, as the names suggest, the source is the file system, then I'd reach
for glob.
Emile
___
Tutor mai
do a demo for that app and then go commercial if
my project impresses the client.
What's the app going to do?
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
supposed to create thumbnails of picture in the directory where I
saved my file.
Which is what it will do when python is started from that directory.
How are you starting python?
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change
,
navigate to the directory where the images are stored, and start python
from there so that glob will find the files.
HTH,
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman
st()
#-End File test.py-
Output:
in class Test
in __main__
in def test
in class Test.__init__
-
As you can see, the print statements at the class level are executing
when encountered, but the prints in defs only when executed.
HTH,
Emile
__
():
if line in aisle_one:
So it's failing this test.
print "success"
else:
print "no joy"
Try adding some debugging code here, maybe changing the print to:
print "no joy matching %s" % line
Then read up on readlines and strin
On 7/14/2010 9:22 AM Eric Hamiter said...
Fantastic! I have this, which now works. Is there a better place to put
string.strip?
I might make the changes below, but there's nothing wrong with the way
you've got it.
aisle_one = ["chips", "bread", "pretzels", "magazines"]
grocery_list = open
ave that done within a class definition and I
expect it shouldn't be there.
HTH,
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
g more specific
than "stream processing" and "*file" pointers hinting at serial
processing of the source py file.
I also found this interesting (but possibly not to newbies :) :
http://www.shinetech.com/attachments/108_python-language-internals.pdf
Emile
_
ameters to your print statement.
HTH,
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
for eachline in opened(sourcefilename):
if line.startswith('@'):
append [sourcefilename, line] to result
# print it
for eachline in result:
print eachline
----
Hope this gets you going,
Emile
___
Tutor maillist - Tutor@
n empty data storage container for use within the processing
loop -- if it wasn't defined before use, you'd get an error the first
time you tried to append to it. There's some good info in the tutorial
-- see http://docs.python.org/tutorial/datastructures.html for details.
Emile
r than in any position
of the line.
IE, instead of something like:
if "@" in line:
...try something more like:
if line.strip().startswith("@"):
This way you won't pick up the email addresses at all, and won't
subsequentl
where
to put new *.py modules you send him, run through it, and you're done.
A little education will likely go a lot further than delving deeper into
heavier technologies in an attempt to 'simplfy'.
HTH,
Emile
___
Tutor maillis
a try. Or try
one of the free versions of Komodo or Wing.
HTH,
Emile
http://downloads.activestate.com/ActivePython/releases/2.6.5.14/ActivePython-2.6.5.14-win32-x86.msi
http://sourceforge.net/projects/numpy/files/NumPy/1.5.0b1/numpy-1.5.0b1-win32-superpack-python2.6.exe/download
http://so
;>> import sys
>>> for ii in sys.path: ii
...
''
'/usr/lib/python24.zip'
'/usr/lib/python2.4'
'/usr/lib/python2.4/plat-linux2'
'/usr/lib/python2.4/lib-tk'
'/usr/lib/python2.4/lib-dynload'
&
itive test when you have this kind of issue.
Then you might have written:
if nummer == reeks[-1] and nummer == reeks[-2]:
print "it's the same as the prior two"
else:
reeks.append(nummer)
HTH,
Emile
reeks.append(nummer)
else:
print 'Nummer: ', nummer, 'is g
d maintain a
second index allowing instant access to the keys associated with a
specific value.
HTH,
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
;re in the same sub-version (2.5)
I agree. 2.5.4 is a bug release for the 2.5 series and by decree may
not introduce backward incompatibilities of any kind. If there's a
compatibility issue, please provide details so it can be verified as it
ought to be re
.
HTH,
Emile
Something along these lines:
class myDict(dict):
def __init__(self):
self.altKeys = {}
def __setitem__(self,ky,val):
self.altKeys[val]=ky
return dict.__setitem__(self, ky,val)
def lookup(self,ky):
return self.altKeys[ky]
a = myDict
if cond:
result.append(ii)
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
ight be an interesting example to parse.
Regards,
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
onoDevelop
2.2 for Python under Ubuntu. IT'S AMAZING!"
http://www.daniweb.com/forums/thread286328.html
So, sounds like a yes to me.
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.py
ble ii is %s-%s" % (ii,ii)
...
>>> for funcobj in (test1,test2): funcobj('spam')
...
single ii is spam
double ii is spam-spam
>>>for funcobj in (test1,test2): test(funcobj)
...
my name is test1
my name is test2
Once defined, code is an object. try dir(test) o
On 8/25/2010 10:56 AM Emile van Sebille said...
>>> def test1(ii): print "my name is %s" % ii.func_name
...
Oops -- my bad editing s/b or once was:
def test1(ii): print "single ii is %s" % ii
___
Tutor mai
e doctests above
I think that u is the name of the new list and v is the number which represent
the number which must be eveluated.
No. u,v are the parameters names for the two lists of numbers of the
same length. So in the example add_vectors([1, 0], [1, 1]), u will take
on the value [1,
t? You'll probably get better answers directly from there than
here.
HTH,
Emile
class SerialDevice(Serial):
def __init__(self,port):
Serial.__init__(self)
self.port = port
self.baudrate = 57600
self.bytesize = EIGHTBITS
self.parity
ingle operation
when the dir will only need to be created a single time (and then may be
written to several hundred times) is pretty wasteful.
Agreed -- if it's in a loop, you'd want to only check once. Of course,
if the directory is eg an nfs share, continued access could be an issue.
ii for jj in alist for ii in blist if jj in ii ]
['column0label', 'column1label', 'dimension0guid']
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
a
[1, 2, 3]
>>> extend(a,[4,5,6])
>>> a
[1, 2, 3, 4, 5, 6]
>>>
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On 9/20/2010 9:54 AM Joel Goldstick said...
That's pretty creative I think, but not sure its quite on the mark for
beginners? ;)
With this one fitting into context so easily, it seemed appropriate.
Emile
___
Tutor maillist - Tutor@python.o
#x27;ve got you assembling the program from bits and
pieces as it's presented and reviewed. Can you post your program as
you've reassembled it so we can see what's actually coded?
Emile
___
Tutor maillist - Tutor@python.org
To unsu
27;)
Using this form of the line,
canvas.create_line(xstart, ystart, xend, yend, fill="red")
seems to do it, although I can't say what versions allowed the author to
(apparently successfully) write
canvas.draw_line(xstart, y
e" and not as "Return the dictionary holding
the current global symbol table" so the fact that it works on may
version (and perhaps all others) doesn't mean it'll work everywhere.
HTH,
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On 9/27/2010 10:54 AM Alex Hall said...
What is wrong with the following line?
self.am=[[(a,b)
for a in range(len(self.lines)) a=0]
for b in range(len(self.lines)) b=0]
The a=0 and b=0 -- what do you think they're doing?
Emile
___
bove to
append it to the end:
for index, row in enumerate(topics.get_rows()):
if row[0] != 'other':
options.append({'name': row[0], 'value': MSG(row[1])})
HTH,
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
ecific packages and related dependencies are
rarely an area of expertise outside the users of the package. Join the
mailing list.
See http://lists.alioth.debian.org/mailman/listinfo/pkg-exppsy-pymvpa
HTH,
Emile
my operating system is Mac Leopard
(i get a depracation warning when I try to
e']
#then sort it
topics.sort(key=sortOtherToEnd)
But, generally, I'd stop once I got it going without worrying too much
about 'better' ways -- that's a subjective measure. There is often one
obvious way to do it, but unless you've seen that way before, ther
On 9/28/2010 9:37 AM Norman Khine said...
thank you, here is the updated version:
http://pastie.org/1186860
The only obvious redundancy is the duplicated sort of options just
before the return. You only need the newer sort_key based one.
Emile
ead of invoking:
options = BusinessType().get_options()
You'd write:
options = BusinessType('topics.cvs').get_options()
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
x27;ll find a lot of
useful info working the tutorial.
HTH,
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
ur second files
contents as a first step to facilitate the subsequent lookups.
You haven't included any code and we can't gauge how far along you are,
so follow up and post the code you write as you go and we'll be better
able to help out.
Hope this is enough to get you started,
Em
syntax
Is that all of your code? it seems to be cut off
Do you see it now? Your reply contained the 10 ten lines or so of code
that follows.
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On 10/2/2010 10:45 AM Steve Willoughby said...
On 02-Oct-10 10:32, Emile van Sebille wrote:
Well, not really -- this is the OPs code. I was responding to Joel's
comment of not seeing the entire post.
File "my_turtle.py", line 19
if (abs(turtle.position()[0]) > turtle.win
x.html
Finally, i'd suggest you start with python2 (vs python3) -- most of the
info you'll find on the net is python2 and not always up to date for
python3.
Good luck!
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change s
On 10/2/2010 4:21 PM Emile van Sebille said...
On 10/2/2010 8:22 AM a a said...
Now my questions:
1) Is python enough and complete to build a simple program of the kind
deskribed above?
Yes
2) Will I be able to build standalone program with it?
Yes
Sorry - Forget to answer your
://www.crummy.com/software/BeautifulSoup/
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
-big-is-over-200Mb-ish-ly y'rs,
Emile
___
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor
On 10/6/2010 11:58 AM Joel Goldstick said...
On Wed, Oct 6, 2010 at 2:50 PM, Emile van Sebille wrote:
On 10/6/2010 9:25 AM Eduardo Vieira said...
Of course this solution is simpler:
extracted = a[a.index("i")+1:]
But I didn't want to build a list in memory with "read
appending its members to allfiles
can be done more simply with append, so where you're saying:
filelist = [...
you could say
allfiles.extend([...
and forget about filelist entirely.
HTH,
Emile
___
Tutor maillist - Tutor@pytho
On 10/8/2010 8:55 PM Steven D'Aprano said...
I'm sorry to tell you that you've just reinvented the wheel. This was
already solved, a long, long time ago. It is called the glob module:
Only if glob now descends into the file system... which is why you'd
choose os.w
1 - 100 of 527 matches
Mail list logo