As an example, let's say you have a main module at /usr/code/Main.py
and you have a module you'd like to import at /usr/code/util/Util.py,
you can do this:
import util.Util
If you are using PyDev and Eclipse to develop your Python code, you can
set the base directory to reference module imports f
Yawn. Go start indenting, and stop using Perl. If Python has such a
nice logo, why waste any more time with Perl?
--
http://mail.python.org/mailman/listinfo/python-list
Call a wc 'free' if it satisfies the propery that every letter 'a' in
it appears only in the form '*a*', and 'anchored' otherwise. What if
all wc's are free? How does this affect the DFA? Does it minimize
nontrivially? Keep in mind I'm new to DFA theory.
Walter Kehowski
--
http://mail.python.org
John Salerno wrote:
> I'm having some trouble finding a function that converts numbers
> (whether integer, hex, whatever) to its binary representation. Is there one?
>
> Thanks.
Get the Gnu Multiple Precision library for Python module (Google GMPY).
>>> import gmpy
>>> help(gmpy.digits)
Help on
John Salerno wrote:
> [EMAIL PROTECTED] wrote:
>
> > Then you'll want to represent the lights as a 20-bit binary number.
> >
> > Each bit position corresponds to 4 lamps
>
> I'm not sure I understand that. If I use a 20-bit number, wouldn't each
>
John Salerno wrote:
> John Salerno wrote:
>
> > Anyway, any advice for how to proceed would be great! I hope I described
> > it well enough.
>
> Ok, after reading the suggestions, I feel better about proceeding. But
> one question: how exactly do I come up with 32 different 20-bit integers
> for ea
Michael Tobis wrote:
> First do a little estimation. We know we have to find four out of 16
> switches,
4 panels, eight switches each, 32 total.
> so the number of possibilities to search is only C(4,16) =
> 1820, so an exhaustive search will work.
Yes, but for the wrong reason. It's not combina
[EMAIL PROTECTED] wrote:
> John Salerno wrote:
> > John Salerno wrote:
> >
> > > Anyway, any advice for how to proceed would be great! I hope I described
> > > it well enough.
> >
> > Ok, after reading the suggestions, I feel better about proceeding. B
Salvatore wrote:
> Hello,
>
> I've read several articles where it's said that Python is weakly typed.
> I'm a little surprised. All objects seem to have a perfectly defined
> type
>
> Am i wrong?
No, you're right. It seems like a lot of people conflate weak vs.
strong typing and static vs. dyna
Michael Tobis wrote:
> Yeah, I misread the question, but the gist of my query remains.
>
> > The odds are 100% if there is at least one solution.
>
> Let's not get too philosophical. My question was whether there was an a
> priori reason for believing that there is a solution.
>
> > You want perm
John Salerno wrote:
> [EMAIL PROTECTED] wrote:
>
> > a = [0xf5fdc,0xf6edb,0xbddb7,0x6fddd,0xeb7ed,0xb977f,0xbfed3,0xedef5]
> > b = [0xddb7d,0xfaddb,0xde75f,0xeef7a,0xdd77b,0xdfbce,0xb77dd,0x7ef5d]
> > c = [0xf37bd,0xdfaee,0xddd6f,0xddfb6,0xb9efb,0xb7bbe,0xecfbd,0xb75df]
John Salerno wrote:
> [EMAIL PROTECTED] wrote:
>
> > You have 4 panels, each with 20 lamps (label them 19 to 0):
> >
> > panel A
> > panel B
> > panel C
> > panel D
>
John Salerno wrote:
> [EMAIL PROTECTED] wrote:
>
> >> (homework? a puzzle book?), I am just
> >> wondering where the puzzle came from.
> >
> > The OP mentioned it came from a puzzle game That made me
> > think there was likely at least one solution.
>
John Salerno wrote:
> John Salerno wrote:
> > [EMAIL PROTECTED] wrote:
> >
> >> No. First of all, combining them with the & operator would be
> >> the asnswer to having all four lamps lit in the same position.
> >> But you want exactly 3 (in any com
John Salerno wrote:
> [EMAIL PROTECTED] wrote:
>
> > If you need help in figuring out how to walk through all 4096 possible
> > switch sets, just ask.
>
> Ok, thanks to your list, I figured out a program that works! It's
> probably not the best, and it doesn
there seems to be an error in your script.
Why don't you execute it directly from IDLE (F5) ? There, you should
see where the problem is.
--
http://mail.python.org/mailman/listinfo/python-list
regarding the constants, this is more for the "vm" (and type safety).
actually enums, constants and symbols can prolly be implemented more or
less the same.
--
http://mail.python.org/mailman/listinfo/python-list
if (os.path.isdir(xrefs) == 0):
os.mkdir(xrefs)
os.path.isdir(stuff) returns
True or False
--
http://mail.python.org/mailman/listinfo/python-list
First, what version of python are you using? 2.4.2 (and some previous
versions) use file() instead of open(), although open may still work.
also, if your code in the previous post is still using:
outputFname = given + '.log'
outputFile = open(os.path.join(xrefs,outputFname), 'w')
I hope you have
For myself, I use kdevelop, KDE's development environment, it handles a
multitude of languages very well, and python is one of them. It has
solid project management, and a slew of other features. If you are
looking for something solid, I would go with kdevelop.
--
http://mail.python.org/mailman
The python code below is adapted from a Haskell program written by
Tomasz
Wielonka on the comp.lang.functional group. It's more verbose than his
since I wanted to make sure I got it right.
http://groups.google.com/group/comp.lang.functional/browse_frm/thread...
Does anyone know how to turn it int
Michael,
Yes! That is precisely what I had in mind!
Thanks,
Walter Kehowski
--
http://mail.python.org/mailman/listinfo/python-list
try running this in python:
print [39.95]
the output i get is:
[39.953]
what's up with that?
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I've been using C++ for a few years and have developed a few projects
in C++. And I'm familar with OO and template metaprogramming.
There are some book like "Learning Perl". It is a little bit tedious
for me, because more material in that book seems obvious for me. I want
some book describe t
>The book "Learning Python" worked for me (a long time C++ person).
Me too. I programmed in nothing but C++ for years, but this book made
learning Python easy.
--
http://mail.python.org/mailman/listinfo/python-list
Clemens Hepper wrote:
> Hi,
>
> [EMAIL PROTECTED] wrote:
> > That's one way to do it. I did it that way because I have the
> > hex patterns memorized.
>
> You should be able to generate your numbers like this:
>
> number = int('001001000100100',
Just barely looked the code answer:
check you scope on the second try block.
if that doesn't work...
I'll read it for real :)
Try PyDev plugin with eclipse - it's served me fairly well, but I did
come from Java - so I'm an eclipse fan already.
--
http://mail.python.org/mailman/listinfo/python-
Ok I felt a little bad for my quick answer, these just seem like
homework problems.
first problem - it's scope. (there are two scope errors in the sample)
white space is meaningful. get consistent with tabs or spaces, or
choose an editor that replaces tab press with space. It'll make life a
lot
Ha, you found it all before I could fire it up.
The whitespace thing is very odd, and it took about a month before I
was comfortable using it for scope.
On the bright side, scope errors are a lot easier to find than you
might think, once you get used to looking at py code.
I thought, if your in t
I have done a few GUI apps in python. I like many started with
tKinter.
tKinter is quick, easy, ugly and limited. It did really well for
little programs I wrote for my wife, like a shopping cart, and some
quick admin tools for clients.
Now I'm a big wxPython fan.
wxPython has a small learning cu
Hi there Christopher, I was wondering if you (or anyone reading this )
could quickly summarize the ways in which unittest is unpythonic, or
point me to somewhere which discusses this.
Is this 'consensus opinion' or mainly your own opinion?
Is there a summary somewhere (in addition to the Zen of
Metapost: http://cm.bell-labs.com/who/hobby/MetaPost.html
Examples:
http://tex.loria.fr/prod-graph/zoonekynd/metapost/metapost.html
ImageMagick: http://www.imagemagick.org/script/index.php
Metapost presupposes you know TeX/LaTeX. If you need help in converting
metapost output to eps or pdf, let me
>>> 1.090516455488E9 / 100
1090.516455488
--
http://mail.python.org/mailman/listinfo/python-list
As far as languages go, Python seems a far better choice than php or
perl based solutions. I haven't tried Ruby - so I can't comment.
The Zope framework for python has been remarkably productive for me
both with and wtihout plone(CMF modules and a look and feel on top of
Zope). The documentation
> def default(self, node, **kw):
> for child in node.getChildNodes():
> return self.visit(child, **kw)
>
> visitExpression = default
I'm not sure I grok this part. It leads to unexpected results:
>>> safe_dict("""gid = 'FPS', type = 'Label', pos = [0, 20], text = 'FPS'
Use PIL..of course..
Sudharshan S
--
http://mail.python.org/mailman/listinfo/python-list
I dont get it..cant the matching take place efficiently with PIL, only
that you need to have a condition i.e if the mismatch exceeds a certain
threshold, they are not similar,
http://gumuz.looze.net/wordpress/index.php/archives/2005/06/06/python-webcam-fun-motion-detection/
Check the above link,
hello,
I use the logging module include in Python 2.4 distribution, and I 'd
like to have a logger witth several Handlers .
I know how to do this by coding in python, but could I specify this
directly in the logger configuration file?
Thanks in advance!
bertrand
--
http://mail.python.org/mailm
ocssolutions.com offers hosting solutions and will host Zope
--
http://mail.python.org/mailman/listinfo/python-list
Hi Luca,
The words xlDiagonalDown e xlNone are Excel constants and don't are in
the Local NameSpace
use these values:
xlNone = -4142
xlDiagonalDown = 5
Then the last line stay like that
"""
packing.ActiveSheet.Selection.Borders(5).LineStyle = -4142
# Excel Constants: xlNone = -4142 xl
hi,
i've just a simple question:
what are the time complexities of inserting / removing / checking if an
element is present in 1) a list and 2) a dictionary?
does anybody know?
thanks
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
I readed in python brazilian list, about a Eagle, it's seems like you
need...
http://www.python.org/pypi/eagle/
http://code.gustavobarbieri.com.br/eagle/
[]s
Luciano Pacheco
--
http://mail.python.org/mailman/listinfo/python-list
Hi.
Can anyone tell me the python code for a simple countdown from eg. 2.00
minutes.
It should be printet out to the screen.
When it is finished it should write "Time is up"
Hope you can help.
Henrik
--
http://mail.python.org/mailman/listinfo/python-list
Actually I recently went from a managed hosting to a virtual host via
XEN, it's been great value for the cost
--
http://mail.python.org/mailman/listinfo/python-list
I used a python api for the linkpoint.com processor a few years ago
I think they still have the python api
--
http://mail.python.org/mailman/listinfo/python-list
what i do is open idle, import the codefile i've begun to write, and
then write a function:
def r():
reload(codefile)
then when I want to run it after changes, I just call the function
manually in idle.
--
http://mail.python.org/mailman/listinfo/python-list
In using a simple smtp routine:
# begin example
>>> import smtplib
>>> server = smtplib.SMTP('outgoing.verizon.net')
>>> server.sendmail('[EMAIL PROTECTED]', '[EMAIL PROTECTED]',
"""To: [EMAIL PROTECTED]
From: [EMAIL PROTEC
Look at the date.
Worry about this if it is still around tomarrow
--
http://mail.python.org/mailman/listinfo/python-list
Dear tjg: That was extremely helpful. Thank you very kindly. The server
did not respond to the .starttls() method but authentication was
successful after, it seems, the .ehlo() was specified. I have tried the
script without the first s.ehlo() and without s.starttls() and it works
perfectly. My auth
a lifetime of idiocy. You
have done us all a great service. Watch out for alcohol poisoning. It
affects the speling senters of your brain. I sure hope
Google doesn't escape HTML tags. This could be
important.
[EMAIL PROTECTED] wrote:
> Programing Languiges Are Ment to be free. That is wh
What OS are you doing this on?
I had an issue similar to this and it was due to default buffering
behavior of my tty's. If I recall correctly I executed a bunch of
settty to eliminate the buffering behavior of stdout. The set the
terminal back to it's original setting when my program was done.
Diez is correct, the C program is writting to stdout, you are reading
from stdout. Default bahavior in most modern Unix like systems is to
buffer std out. I stumbled on this a long time ago, so I am trying to
remember the details.
What I think is happening here, you call the child process, it do
Hi all,
I've written a Python script with functionality similar to the Unix
"script" program, which keeps a record of shell commands issued (I
capture some additional stuff like timestamps). The code is borrowed
largely from
http://groups.google.com/group/comp.lang.python/msg/de40b36c6f0c53cc
Any
I figured out the problem, fix involves modifying one of the lines in
the original program (from
http://groups.google.com/group/comp.lang.python/msg/de40b36c6f0c53cc)
to:
raw_lflag = self.lflag & ~(termios.ICANON|termios.ECHO|termios.ISIG)
(termios.ISIG was added)
Lorin
--
http://mail.python.o
I'm trying to get the data on the "Central London Property Price Guide"
box at the left hand side of this page
http://www.findaproperty.com/regi0018.html
I have managed to get the data :) but when I start looking for tables I
only get tables of depth 1 how do I go about accessing inner tables?
sam
This code come up, fairly centered in my screen. What do you mean by
move?
--
http://mail.python.org/mailman/listinfo/python-list
Hey Kent,
thanks for your reply. how did you exactly save the file in firefox? if
I save the file locally I get the same error.
print len(soup('table')) gives me 4 instead 25
--
http://mail.python.org/mailman/listinfo/python-list
so it must be the malformed HTML comment that is confusing BS. I might
try different methods to see if I get the same problem...
thanks
--
http://mail.python.org/mailman/listinfo/python-list
Ok so I'm not to bright sometimes
Well if you want this kinda control I suggest you go ahead and subclass
toplevel, but the simple answer before running
root.mainloop()
make a call to
root.geometry(geometryString)
geoometrystring is in the format WxH+X+Y - you may hve to do some
screen cal
Thanks Kent that works perfectly.. How can I strip all the HTML and
create easily a dictionary of {location:price} ??
--
http://mail.python.org/mailman/listinfo/python-list
are you using PyXML?
If this is a simple one to one relationship with dependence on order,
I'd forgo the whole PyXML, read the file line by line, and replace tags
as appropriate. You may have to do some simple checkin, in case there
is n object
Otherwise, have fun with the parsers - nothing is
Frederick,
I didn't know about cElementTree before, wow - this is a lot nicer than
PyyXML - and a whole lot faster. Almost makes my comments about
dealing with the xml as text, completely pointless.
--
http://mail.python.org/mailman/listinfo/python-list
This took a moment
I spent a lot of time stupidly thinking about right/left sorting, is it
looping? no that's not it...doh Then the light
then realized this
if self.key == key:
return 1
elif key < self.key:
if self.left:
self.left.find(key
If you don't write or otherwise maintain Python Extension Modules
written in C (or C++), you can stop reading.
Python 2.5 alpha 1 is in the process of being released later today.
There are important changes that are in 2.5 to support 64-bit systems.
These changes can cause Python to crash if your
Todd wrote:
> Steve R. Hastings wrote:
> > When you compile the expression
> >
> > for i in range(1000):
> > pass
> >
> > does Python make an iterator for range(), and then generate the values
> > on the fly? Or does Python actually allocate the list [0, 1, 2, ..., 999]
> > and then s
Chris Lasher wrote:
> Hi all,
> How can one count all the permutations of a substring in a string? For
> a more concrete example, let's say
> targetstr = 'AAA'
> and
> probestr = 'AA'
>
> I want to consider how many times one can count probestr ('AA') in
> targetstr ('AAA'). The value in this exam
[EMAIL PROTECTED] wrote:
> Chris Lasher wrote:
> > Hi all,
> > How can one count all the permutations of a substring in a string? For
> > a more concrete example, let's say
> > targetstr = 'AAA'
> > and
> > probestr = 'AA'
> >
okay wrote:
> Hello,
>
>
> http://www.av1611.org/666/biochip.html
>
> To Archbishop Christodoulos Paraskevaides of the Greek Orthodox Church
> in Athens and Greece
> Archbishop,
> I talked with a Greek Orthodox believer in Australia and he told me two
>
I'm thinking a list comprehension...
--
h
denyhosts
denyhosts.sourceforge.net
I used it at a recent contract sys. admin job, and found it so handy I
installed it on my home gateway FreeBSD box. It ROCKS!!! I watch the
system logs just to snicker when it stops a sshd attack dead in its
tracks ;-0
Curtis
--
http://mail.python.org/mailma
Serge Orlov wrote:
> bruno at modulix wrote:
> > Steven Bethard wrote:
> > > The PEP below should be mostly self explanatory. I'll try to keep the
> > > most updated versions available at:
>
> [snip]
>
> >
> > Seems mostly clean. +1.
> >
>
> That's what Trojans said when they saw a wooden horse at
John Salerno wrote:
> So last night I had a dream that me and two other guys needed to get a
> simple task done in Java. We were staring at the problem in confusion
> and I kept saying "First we have to create a class, then instantiate it,
> then..." etc. etc. They didn't agree with me so we kept
nment variables are ORACLE_HOME=/usr/lib/oracle and
LD_LIBRARY_PATH=$ORACLE_HOME/lib. I am trying to connect to Oracle
database:
>>>import cx_Oracle
>>>db=cx_Oracle.connect('sergio/[EMAIL PROTECTED]')
Traceback (most recent call last):File "", line 1, in ?
Runtime
Byte wrote:
> How come:
>
> sum = 1/4
> print sum
>
> returns 0? 1/4=0.25, not 0. How do I fix this?
Make sure there is at least one float in your equation. In your example
Python is doing interger math for you and returing the floor. You need
to give it a hint that you would like to do floating p
wesley's core python programming (i m havin the old one) has a good
chaper on Tkinter.
--
http://mail.python.org/mailman/listinfo/python-list
Byte wrote:
> That dosnt work either:
>
> sum = 0.1+1/4
> print sum
>
> Just returns 0.1
You get precedence right? Your equation does not evaluate from left to
right. 1/4 happens first, and since there are no floats you get 0.
in that equation you basically are doing this:
sum = 1/4
print sum
0
John Salerno wrote:
> Similar to the Python Challenge, does anyone know of any other websites
> or books that have programming puzzles to solve? I found a book called
> "Puzzles for Hackers", but it seems like it might be a little advanced
> for me, and I've also read that it focuses too much on en
Michael Tobis wrote:
> The first piece of code that I ever voluntarily wrote was intended to
> solve this puzzle:
>
> Assign the number 2 to 'a', 3 to 'b' ... 27 to 'z'. To each word assign
> the value of the product of its characters. Find the English (or
> language of your choice) word whose pro
[EMAIL PROTECTED] wrote:
> Hi.
>
> I'm writing a program that is dependent on the curses library and
> functions for python, and I'm a little puzzled by the way characters
> are handled. The basics of the program are that a character is taken
> from input and put into
Paul Rubin wrote:
> "Michael Tobis" <[EMAIL PROTECTED]> writes:
> > The first piece of code that I ever voluntarily wrote was intended to
> > solve this puzzle:
> >
> > Assign the number 2 to 'a', 3 to 'b' ... 27 to 'z'. To
Fredrik Lundh wrote:
> [EMAIL PROTECTED] wrote:
>
> > The trouble with word lists is when you run across something
> > you don't recognize, like "ixodid", you can't tell if it's a word or
> > an acronym or an abbreviation. Being in the environm
err...this is chinese..
--
http://mail.python.org/mailman/listinfo/python-list
You can also just type buf.getvalue() which returns the current
StringIO buffer as a python string, without the rewinding
--
http://mail.python.org/mailman/listinfo/python-list
You can do this in Python as well. Check out the property built-in
function. One can declare a property with a get, set, and delete
method. Here's a small example of a read-only property.
class Test(object):
def getProperty(self):
return 0;
prop = property(fget = getProperty)
Hi
I would like to be able to get the inputs that are needed into a
template file programmatically.
For example if we had a template:
=
$name has $num marbles in his hand.
=
I want to be able to initialise this template and call a method on it
to get the
I try to create an exe using py2exe, but i've got some troubles. In my
application, i use a flash activex control with wxPython
(wx.lib.activexwrapper). I get the following lines in the log when i
run my executable
Code:
Traceback (most recent call last):
File "main.py", line 8, in ?
File "mis
it doesn't work only under windows 98 first edition, still don't know
how to fix this.
--
http://mail.python.org/mailman/listinfo/python-list
re.sub() doesn't do the substitution in place: it returns the resulting
string. Try this:
myString = 'D c a V e r " = d w o r d : 0 0 0 0 0 6 4 0'
import re
newString = re.sub("\s", "", myString)
print newString
--
http://mail.python.org/mailman/listinfo/python-list
This is new to me. I did not know that emacs HAD a word star mode.
I may have to look at emacs again (last time was 1995).
I am still looking for a python editor I like. Yes I used to write asm
code in
wordstar in nondocument mode. And yes all of the old dos editors used
the wordstar keys. Eve
Kun wrote:
> I am trying to make an if-statement that will not do anything and print
> 'nothing entered' if there is nothing entered in a form. I have the
> following code that does that, however, now even if I enter something
Yes, but did you enter everything?
> into the form, the code still o
Hello,
Now I 'm learning python to do testing jobs, and want to use it in
TestMaker.
The problem is: I don't know how to use python in TestMaker.
Just write python program in it or call .py files in it?
I am really new about it and need some help.
Thanks a lot!
--
http://mail.python.org/mailma
Paddy wrote:
> kelin,[EMAIL PROTECTED] wrote:
> > Hello,
> >
> > Now I 'm learning python to do testing jobs, and want to use it in
> > TestMaker.
> > The problem is: I don't know how to use python in TestMaker.
> > Just write python program i
lot!
Gabriel Genellina wrote:
> At Wednesday 18/10/2006 23:34, kelin,[EMAIL PROTECTED] wrote:
>
> >Now I 'm learning python to do testing jobs, and want to use it in
> >TestMaker.
> >The problem is: I don't know how to use python in TestMaker.
> >Just writ
Hi,
Does anyone have the .pdf file of the book THE MYTHICAL MAN-MONTH?
Then could you please send it to me( [EMAIL PROTECTED] )?
Thanks a lot!
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
Today I read the following sentences, but I can not understand what
does the __init__ method of a class do?
__init__ is called immediately after an instance of the class is
created. It would be tempting but incorrect to call this the
constructor of the class. It's tempting, because it looks li
Hi,
I've read all of this. And I am clear about it.
Thanks all.
Best Regards!
Gabriel Genellina wrote:
> At Tuesday 7/11/2006 21:47, Jia Lu wrote:
>
> > > In Python, the real constructor is called __new__, >
> > > Carl Banks
> >
> >But the code below won't invoke __new__:
>
> Is this a question, o
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
The Python documentation states:
[quote]
start( )
Start the thread's activity.
This must be called at most once per thread object. It arranges for
the object's run() method to be invoked in a separate thread of control.
[/quote]
So
> [EMAIL PROTECTED] wrote:
> > is there a simple way in perl, python, or awk/shell/pipe, that gets
> > the user agent field in a apache log?
> Something like:
> # cut -d '"' -f 6 < httpd-access.log
> ?
> --
> mph
Doesn't it feel li
Hi,
I am still new to Python and Tkinter, so I apologize in advance if I do
not word my question optimally. I am trying to use a frame widget as the
parent for other widgets. There is a class with the header "class
classtitle(Frame):" in a script called classtitle.py. Having imported
Here is an example of what I tried to do:
from Tkinter import *
import classtitle
import classtitle2
BLUE1 = '#7080B0'
RED1 = '#B08080'
class Master(Frame):
def createWidgets(self):
self.FrameOne = Frame(self)
self.FrameOne.grid(sticky = NW)
self.FrameOne["backgroun
Hi,
I am looking for documentation on the plot module. Does anyone know where I
can find this information? Thanks.
Shankar
--
http://mail.python.org/mailman/listinfo/python-list
4801 - 4900 of 4919 matches
Mail list logo