A simple way to get individual values for the distribution is:
d = {}
for i in range( 0, 1000):
j = random.randrange( 0, 100)
if d.has_key(j):
d[j] += 1
else:
d[j] = 1
keys = d.keys()
keys.sort()
for key in keys:
print key, ":", "*" * d[key]
--
http://mail.pytho
Thanx.
It just popped in my mind.
in 3d programming there are transformation matrices like
a=[[cos(x),sin(x),0],[-sin(x),cos(x),0],[0,0,1]]
it is a 3x3 matrix. never changes during program.
it can be defined like
>>> def transmat(x):
... dummy=[[0,0,0],[0,0,0],[0,0,0]]
... d
John Machin schrieb:
> ...
>
> Some suggestions:
>
> 1. Try Pyrex. You get to write in a higher-level language and it does
> all the boring ugly error-prone stuff for you -- this includes
> reference counting as well! Look at the C code that Pyrex generates,
> to see what Pyrex is saving you from
Hi All--
[EMAIL PROTECTED] wrote:
>
> I'm currently attempting something with
>
> http://www.python.org/doc/current/lib/node368.html
>
> but it seems the read operation is ignoring these signals just as it is
> ignoring my signals from the kill command -- perhaps unsurprisingly.
>
> Perhaps
John J. Lee wrote:
> Yes. ISTR that licence is a British English spelling, though my
> British brain has been thoroughly contaminated by US spellings and
> usage by now.
Oh, it only gets worse: a couple years on the illiterate intarweb and
even basics like "its" and "it's" become a major struggle
"dcrespo" <[EMAIL PROTECTED]> writes:
> Hi Grant Edwards...
>
> Your solution requires a previous installation of Acrobat. Internally,
> the OS is sending the pdf file to the Acrobat PDF Driver and then it is
> sent to the printer. So you have to have Acrobat installed. Don't you?
No, you don't.
On Friday 22 April 2005 07:19 am, codecraig wrote:
> Ok, I have the following directory structure
>
> C:\pycode
>--> blah.py
>--> mynewdir
> --> __init__.py
> --> abc.py
>
> [[ C:\pycode\mynewdir\abc.py ]]
>
> def doFoo():
> print "hi"
>
> def doBar():
> print "bye"
On 22 Apr 2005 15:18:53 -0700, [EMAIL PROTECTED] wrote:
>Thanx for your replies.
>
>I'm looking for array of functions.
>Something like a=[ sin(x) , cos(x) ]
>
x=0.0
a
>[0, 1]
x=1.0
a
>...
>
>of course it can be made by
def cratearray(x):
>...
>...
Michael Spencer wrote:
> [EMAIL PROTECTED] wrote:
> > I'm back...
> [wondering why copy.deepcopy barfs on array instances]
> >
>
> http://www.python.org/doc/2.3.3/lib/module-copy.html
> deepcopy:
> ...
> This version does not copy types like module, class, function,
method, stack
> trace, stack fra
On Friday 22 April 2005 01:39 am, [EMAIL PROTECTED] wrote:
> I am a newbie to python. I have a makefile which i can compile in
> UNIX/LINUX, But i
> I am planning to write a python script which actually does what my
> MAKEFILE does. The make file is
[...]
> I want to write a python script to r
>>I think of it like the ''.join semantics. The object knows best how
to
>>handle join (even if it looks wierd to some people). In the #! case,
>>the program knows best how to start itself.
>This I don't understand ;-)
With ','.join(['a','b','c'])You rely on what wants to join the
sequence t
Scott David Daniels wrote:
>
>
> See, the body of your anonymous function just looks for "the current
> value of n" when it is _invoked_, not when it is _defined_.
The "lambda functions" was an unclear part of the tutorial I read.
Should I use them? Are they pythonic?
As far I see they are good o
Searching the archives for something related to the title, I found a
few relevant threads (e.g. http://tinyurl.com/avyg6 or
http://tinyurl.com/b5b6v); however they don't seem to give a
satisfactory answer, so here it goes again: What's the equivalent
new-style Delegate class ?
class Delegate:
Jeremy Bowers wrote:
I have an image in the Python Image Library. I'm trying to get it into
PyGTK in color. Is there any way to do this cross-platform, preferably
without writing to anything to the disk?
PIL apparently can't write XPMs. GTK will only take XPMs, that I can see.
Therein lies the rub.
"[EMAIL PROTECTED]" wrote:
Sub print_matrix(xmat() As Double)
Debug.Print UBound(xmat, 1), UBound(xmat, 2)
'do stuff with xmat
End Sub
It is trivial to allocate and pass multidimensional arrays in VBA, but
C requires expertise with pointers. The subroutine print_matrix can
query the dimensions of x
Greetings,
I've been wondering if there is a mechanism similar to trace/untrace
found in lisp, for example call trace(function-name) and whenever this
function is called it will show its parameters to stdout
--
http://mail.python.org/mailman/listinfo/python-list
"Stormbringer" wrote:
I've been wondering if there is a mechanism similar to trace/untrace
found in lisp, for example call trace(function-name) and whenever this
function is called it will show its parameters to stdout
def trace(func):
def tracer(*args, **kwargs):
print func.__name__
Why is that I can only get the PhotoImage class to show up when I write
a straight procedural script (no object orientation) but not when I try
to use object-orientation?
These two scripts in theory should produce the same results but they
don't. Is there any reason why?
---Procedural---
roo
Is there anyone who already ported python onto a acme-systems linux
fox-board?
http://www.acmesystems.it/
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
i wonder if there is an automatic way to make that without calling a
function.
You mean without _explicitely_ calling a function.
May I inquire why you need to write f instead of f(x)?
an automatic way that depends on changing the value of x. as each time
x=something used t
Harlin Seritt wrote:
Why is that I can only get the PhotoImage class to show up when I write
a straight procedural script (no object orientation) but not when I try
to use object-orientation?
These two scripts in theory should produce the same results but they
don't. Is there any reason why?
in the
Thank you Fredrik !
With a little tweaking for the right indentation it should prove useful
:)
Fredrik Lundh wrote:
> "Stormbringer" wrote:
>
> > I've been wondering if there is a mechanism similar to
trace/untrace
> > found in lisp, for example call trace(function-name) and whenever
this
> > func
Is anyone capable of providing Python advantages over PHP if there are
any?
Cheers,
L.
--
http://mail.python.org/mailman/listinfo/python-list
Lad skrev:
> Is anyone capable of providing Python advantages over PHP if there are
> any?
Much more compact and yet much more readable code, making it easier to
maintain and extend your programs.
--
Leif Biberg Kristensen
http://solumslekt.org/
--
http://mail.python.org/mailman/listinfo/python
Lad wrote:
Is anyone capable of providing Python advantages over PHP if there are
any?
Python is a programming language in more ways than simple Turing
completeness. PHP isn't.
--
http://mail.python.org/mailman/listinfo/python-list
Randall Hopper <[EMAIL PROTECTED]> writes:
> What is the correct way to propagate exceptions from Python callbacks?
>
> When I do this:
>
> Python -> C++ -> Python Callback
>
> (example attached) an exception raised in the callback doesn't make it back
> across C++ to Python.
>
>
I decided to use SAX to parse my xml file.
But the parser crashes on:
File "/usr/lib/python2.3/site-packages/_xmlplus/sax/handler.py", line 38, in
fatalError
raise exception
xml.sax._exceptions.SAXParseException: NCBI_Entrezgene.dtd:8:0: error in
processing external entity reference
This i
> You're use of the word "driver" is one with which I'm not
> familiar. But I don't really "do windows" so it's probably a
> Widnowism.
It could be that he means that creating PDFs on windows is done using a fake
printer that will produce the pdf when being printed to - and that fake
printer is i
Lad wrote:
>Is anyone capable of providing Python advantages over PHP if there are
>any?
>
>
I am also new to python but I use php for 4 years. I can tell:
- python is more *pythonic* than php
- python has its own perfume
http://www.1976.com.tw/image/trussardi_python_uomo.jpg and it's nice.
ph
Thomas Heller:
|> Python -> C++ -> Python Callback
|>
|> (example attached) an exception raised in the callback doesn't make it back
|> across C++ to Python.
...
|> void callback_wrapper( void *user_data )
|> {
|> // Acquire interpreter lock
|> PyGILState_STATE gstate = PyGILState_
On 2005-04-23, Diez B. Roggisch <[EMAIL PROTECTED]> wrote:
>> You're use of the word "driver" is one with which I'm not
>> familiar. But I don't really "do windows" so it's probably a
>> Widnowism.
>
> It could be that he means that creating PDFs on windows is
> done using a fake printer that wil
Mage <[EMAIL PROTECTED]> wrote in news:mailman.2339.1114242211.1799.python-
> The "lambda functions" was an unclear part of the tutorial I read.
> Should I use them? Are they pythonic?
> As far I see they are good only for type less a bit.
And to obfusicate code. lambda is evil, do not play with
Mage wrote:
Scott David Daniels wrote:
See, the body of your anonymous function just looks for "the current
value of n" when it is _invoked_, not when it is _defined_.
The "lambda functions" was an unclear part of the tutorial I read.
Should I use them? Are they pythonic?
As far I see they are good
> "Ilpo" == Ilpo NyyssÃnen writes:
>> so you picked the wrong file format for the task, and the slowest
Ilpo> What would you recommend instead?
Ilpo> I have searched alternatives, but somehow I still find XML
Ilpo> the best there is. It is a standard format with standard
limodou wrote:
great!
How about change the bbcode like editor to FCKeditor? I think
FCKeditor is much better, or make it as an optional editor which the
user could select it himself.
Isn't that pretty heavyweight for a blog?
I mean; Frog is not a CMS with which you write HTML pages...
Then again, i
> "Leif" == Leif K-Brooks <[EMAIL PROTECTED]> writes:
Leif> Lad wrote:
>> Is anyone capable of providing Python advantages over PHP if there are
>> any?
Leif> Python is a programming language in more ways than simple Turing
Leif> completeness. PHP isn't.
+1 QOTW.
--
Vil
> php doesn't have any smell
au contraire! I've seen many code smells in PHP.
http://c2.com/cgi/wiki?CodeSmell
--
Regards,
Diez B. Roggisch
--
http://mail.python.org/mailman/listinfo/python-list
weston wrote:
> This problem may be addressed here:
>
> http://sourceforge.net/mailarchive/message.php?msg_id=1702374
>
> Apparently setup.py tries to compile a c file, which of course
doesn't
> work if there's no compiler.
In fact it does not work even if there is a compiler - seems distutils
ha
Mage <[EMAIL PROTECTED]> wrote or quoted:
> check this: http://wiki.w4py.org/pythonvsphp.html
Good - but it hardly mentions the issue of security - which seems
like a bit of a problem for PHP at the moment.
--
__
|im |yler http://timtyler.org/ [EMAIL PROTECTED] Remove lock to reply.
fuzzylollipop <[EMAIL PROTECTED]> wrote or quoted:
> try spelling license correctly next time and heading the google
> suggestions that probably looked like "didn't you mean : Python License"
How do you spell license correctly?
--
__
|im |yler http://timtyler.org/ [EMAIL PROTECTED] R
On 22 Apr 2005 20:45:55 -0700, "El Pitonero" <[EMAIL PROTECTED]> wrote:
>Bengt Richter wrote:
>> I still don't know what you are asking for, but here is a toy,
>> ...
>> But why not spend some time with the tutorials, so have a few more
>cards in your deck
>> before you try to play for real? ;-)
>
Willem Ligtenberg wrote:
Is there an easy way, to couple data together. Because I have discoverd an
irritating feature in the xml file.
Sometimes this is a database reference:
UCSC
1234
And sometimes:
UCS
Tim Tyler wrote:
>Mage <[EMAIL PROTECTED]> wrote or quoted:
>
>
>
>>check this: http://wiki.w4py.org/pythonvsphp.html
>>
>>
>
>Good - but it hardly mentions the issue of security - which seems
>like a bit of a problem for PHP at the moment.
>
>
I don't think so. Bad programmers are able to
Each function has a func_code property that is suposed to contain the
pure bytecode of the function. All the context (including reference to
relevant namespaces) is stored in different fields of the function
object. Since 'exec' is able to execute any string or bytecode in the
current scope, it
"Lad" <[EMAIL PROTECTED]> writes:
> Is anyone capable of providing Python advantages over PHP if there are
> any?
> Cheers,
> L.
PHP is strongly wedded to providing web-based content, while Python can
be used to build a large number of different types of applications.
--
Kirk Job-Sluder
"The
Jesper Olsen wrote:
> > Apparently setup.py tries to compile a c file, which of course
> doesn't
> > work if there's no compiler.
>
> In fact it does not work even if there is a compiler - seems distutils
> has been broken in python2.4 (it works in python2.3).
distutils works just fine in 2.4.
b
On 22 Apr 2005 21:16:04 -0700, [EMAIL PROTECTED] wrote:
>>>I think of it like the ''.join semantics. The object knows best how
>to
>>>handle join (even if it looks wierd to some people). In the #! case,
>>>the program knows best how to start itself.
>
>>This I don't understand ;-)
>
>With ','.joi
I've been a PHP and Perl programmer (amongst others) for 10 years or
more now, and a Python coder for 3 or so.
I have come to hate PHP now, it's pseudo-OOP is awful, it's dog slow at
handling XML, it's so easy to use that most of the programmers I've had
contact with are very sloppy and do things
I have a PC with Debian sid installed. I install all my Python stuff in
/usr/local. I just installed numarray 1.3.1. Blaslite and lapacklite
were compiled. Did the installation process search for blas and lapack?
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 23 Apr 2005 10:20:29 +0200, Fredrik Lundh wrote:
> which discusses draw_rgb_image and friends, and says that "if you can
> convert your PIL image to a pixel data string or buffer object, you could
> use them to display the image". here's some code that seems to do exactly
> that:
>
>
"Mage" wrote:
> I don't think so. Bad programmers are able to write bad programs in any
> language.
in PHP, good programmers are able to write bad programs without
even noticing.
(every successful server attack I've seen closely the last few years
have been through PHP. it's totally without com
> You're use of the word "driver" is one with which I'm not
> familiar. But I don't really "do windows" so it's probably a
> Widnowism.
It is a windowism but not exclusively ;).
http://www.collaborium.org/onsite/romania/UTILS/Printing-HOWTO/winprinters.html
This is the first link I found that men
Fredrik Lundh wrote:
>
>sql injection? what's your excuse for not using data binding?
>
>
I am not sure I truly understand your question.
So far my own servers didn't get successful sql injection attack. I just
saw some on other sites and did one for demonstration.
Avoid them is easy with set_
On Sat, 23 Apr 2005 20:13:24 +0200, Mage wrote:
> Avoid them is easy with set_type($value,"integer") for integer values and
> correct escaping for strings.
"Avoiding buffer overflows in C is easy, as long as you check the buffers
each time."
The *existence* of a technique to avoid problems is not
# [EMAIL PROTECTED] / 2005-04-23 15:53:17 +0200:
> Lad wrote:
>
> >Is anyone capable of providing Python advantages over PHP if there are
> >any?
>
> I am also new to python but I use php for 4 years. I can tell:
>
> - python is more *pythonic* than php
> - python has its own perfume
> http://w
On Sat, 2005-04-16 at 08:12 -0600, Uche Ogbuji wrote:
> On Sat, 2005-04-09 at 14:09 -0700, dzieciou wrote:
>
> > I'm new-comer in Python.
> > I want to install few Python modules (4Suite, RDFLib, Twisted and Racoon)
> > in my home directory, since Python installation is already installed in the
>
Has anyone used Python with Tile Studio to create games?
http://tilestudio.sourceforge.net/
André
--
http://mail.python.org/mailman/listinfo/python-list
On Sat, 2005-04-23 at 15:20 +0200, Willem Ligtenberg wrote:
> I decided to use SAX to parse my xml file.
> But the parser crashes on:
> File "/usr/lib/python2.3/site-packages/_xmlplus/sax/handler.py", line 38,
> in fatalError
> raise exception
> xml.sax._exceptions.SAXParseException: NCBI_En
I have a question on python lists.
Suppose I have a 2D list
list = [[10,11,12,13,14,78,79,80,81,300,301,308]]
how do I convert it so that I arrange them into bins .
so If i hvae a set of consecutive numbers i would like to represent
them as a range in the list with max and min val of the range alo
I tried to install Ming
(http://sourceforge.net/projects/ming/)
on Windows to use with Python *but*
I can't [/don't know how to] use "make" to install it.
Does anyone know where I could find a ready-made compiled
version for Windows to just "put in" my site-packages directory.
Any help would be app
[EMAIL PROTECTED] wrote:
>I have a question on python lists.
>Suppose I have a 2D list
>list = [[10,11,12,13,14,78,79,80,81,300,301,308]]
>how do I convert it so that I arrange them into bins .
>so If i hvae a set of consecutive numbers i would like to represent
>them as a range in the list with
Le Sat, 23 Apr 2005 19:11:19 +0200, Fredrik Lundh a écrit :
> in PHP, good programmers are able to write bad programs without
> even noticing.
+1 QOTW
---
The use of COBOL cripples the mind; its teaching should, therefore, be
regarded as a criminal offense.
Dr. E.W. Dijkstra
--
http://mail.pyth
IIRC, no. But the setup.py script is fairly easy to hack to link in
your own blas/lapack libraries.
--
http://mail.python.org/mailman/listinfo/python-list
If I have
ex: x = [[1,1,1,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0],
[1,1,1,0,1,1,0,0,0,0,0,1,1,1,1,0,0,0],
[1,1,1,0,1,1,1,0,1,1,0,1,1,1,0,0,0,0],
[0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0]]
what I want is a boundingbox over the region where we find clusters of
1's.So for instance in th
I came up with a simpler description of the problem.
It's all in the simple source:
# we define 'print b' in three different ways: as a string,
# a bytecode and a function
string="print b"
code=compile(string,'string','exec')
def function():
print b
# now we make functions that test if it is
I didn't make the XML file. And I don't like messing with other peoples
data. So I just want my SAX parser to ignore it. I can't help if other
people make it hard for me to read their xml file...
On Sat, 23 Apr 2005 13:48:49 -0600, Uche Ogbuji wrote:
> On Sat, 2005-04-23 at 15:20 +0200, Willem Li
yes that makes sense.But the problem I am facing is if list=
[300,301,303,305] I want to consider it as one cluster and include the
range as [300,305] so this is where I am missing the ranges.
so If the list has l = [300,301,302,308,401,402,403,408] i want to
include it as [[300,308],[401,408]].
Filip Dreger wrote:
Each function has a func_code property that is suposed to contain the
pure bytecode of the function. All the context (including reference to
relevant namespaces) is stored in different fields of the function
object. Since 'exec' is able to execute any string or bytecode in th
Filip Dreger wrote:
I am trying to find a way of executing functions without creating a
nested scope, so they can share local and global namespace (even if
they are declared in some other module).
Why? Can you explain what the use case is?
STeVe
--
http://mail.python.org/mailman/listinfo/python-
On 4/23/05, Willem Ligtenberg <[EMAIL PROTECTED]> wrote:
> so that will be sax.handler.feature_external_ges = "false"
Yes.
> And it will work?
Honestly, I'm not sure. It should, but I've found these edge cases a
bit hard to predict in the Python built-in libs :-(
> But what about using a cata
On Sat, Apr 23, 2005 at 05:13:29PM -0300, Andr? Roberge wrote:
> I tried to install Ming
> (http://sourceforge.net/projects/ming/)
> on Windows to use with Python *but*
> I can't [/don't know how to] use "make" to install it.
>
> Does anyone know where I could find a ready-made compiled
> version
On Wed, 20 Apr 2005 23:06:51 -0400, Peter Hansen <[EMAIL PROTECTED]> wrote:
> John Reese wrote:
>> Is there a memory or heap profiler for python programs? So that, for
>> example, if a program was bloating over time I could see how many of
>> each object there were and maybe even where the referen
On Saturday 23 April 2005 12:50 pm, [EMAIL PROTECTED] wrote:
> I have a question on python lists.
> Suppose I have a 2D list
> list = [[10,11,12,13,14,78,79,80,81,300,301,308]]
> how do I convert it so that I arrange them into bins .
> so If i hvae a set of consecutive numbers i would like to repr
Uzytkownik "Steven Bethard" <[EMAIL PROTECTED]> napisal w
wiadomosci news:[EMAIL PROTECTED]
> Filip Dreger wrote:
>> I am trying to find a way of executing functions without creating a
>> nested scope, so they can share local and global namespace (even if
>> they are declared in some other modu
Mage wrote:
However one of the worst cases is the sql injection attack. And sql
injections must be handled neither by php nor by python but by the
programmer.
But Python's DB-API (the standard way to connect to an SQL database from
Python) makes escaping SQL strings automatic. You can do this:
cu
Filip Dreger wrote:
If I had a magic function 'exec in current scope' I would implement it
like this:
class actor:
def __init__():
self.roles=[]
def act():
for i in self.roles:
exec i in current scope
then the roles would simply be functions defined in any importable
file. For
Greetings,
I'm wondering why the >> operator does not use the write() method of a
class derived from the built-in file class as in DerivedFile below.
In the following example:
- StringFile is just a file-like string accumulation class that can be
used in place of a real file to accumulate string
Uzytkownik "Steven Bethard" <[EMAIL PROTECTED]> napisal w
wiadomosci news:[EMAIL PROTECTED]
> See the documentation:
>
> http://docs.python.org/ref/dynamic-features.html
>
> """The eval(), execfile(), and input() functions and the exec
> statement do not have access to the full environment for r
Filip Dreger wrote:
Uzytkownik "Steven Bethard" <[EMAIL PROTECTED]> napisal w
wiadomosci news:[EMAIL PROTECTED]
See the documentation:
http://docs.python.org/ref/dynamic-features.html
"""The eval(), execfile(), and input() functions and the exec
statement do not have access to the full environme
"Simon John" <[EMAIL PROTECTED]> writes:
> I still love Perl, it's a bit of an art form, as "there's more than one
> way to do it", whereas Python usually only allows one way to do it,
> which may or may not be a better mantra
The Python mantra leads to 1) less programmer overhead, and 2) fas
Dennis Lee Bieber <[EMAIL PROTECTED]> writes:
> On Fri, 22 Apr 2005 17:41:22 -0500, Mike Meyer <[EMAIL PROTECTED]> declaimed
> the following in comp.lang.python:
>
>> No, you don't. My print system does that, and I don't have acrobat
>> installed. I have ghostscript installed, which includes pdf2p
John Bokma wrote:
Not. Perl and Java use similar methods where one can specify place holders,
and pass on the data unescaped. But still injection is possible.
How?
--
http://mail.python.org/mailman/listinfo/python-list
On 2005-04-23, Mike Meyer <[EMAIL PROTECTED]> wrote:
>>> No, you don't. My print system does that, and I don't have
>>> acrobat installed. I have ghostscript installed, which
>>> includes pdf2ps - which handles this particular translation.
>>>
>> Okay, so you've converted one page layout lang
John Bokma wrote:
my $sort = $cgi->param( "sort" );
my $query = "SELECT * FROM table WHERE id=? ORDER BY $sort";
And the equivalent Python code:
cursor.execute('SELECT * FROM table WHERE id=%%s ORDER BY %s' % sort,
[some_id])
You're right, of course, about being *able* to write code with SQL
inj
Leif K-Brooks skrev:
> But Python's DB-API (the standard way to connect to an SQL database
> from Python) makes escaping SQL strings automatic. You can do this:
>
> cursor.execute('UPDATE foo SET bar=%s WHERE id=%s', ["foo'bar", 123])
So. I've been writing SQL queries in Python like this, using
[EMAIL PROTECTED] wrote:
...
list = [[10,11,12,13,14,78,79,80,81,300,301,308]]
how do I convert it so that I arrange them into bins .
so If i hvae a set of consecutive numbers i would like to represent
them as a range in the list with max and min val of the range alone.
I shd get something like
l
Jack Diederich wrote:
On Sat, Apr 23, 2005 at 05:13:29PM -0300, Andr? Roberge wrote:
I tried to install Ming
(http://sourceforge.net/projects/ming/)
on Windows to use with Python *but*
I can't [/don't know how to] use "make" to install it.
Does anyone know where I could find a ready-made compiled
v
Colin J. Williams wrote:
Jack Diederich wrote:
On Sat, Apr 23, 2005 at 05:13:29PM -0300, Andr? Roberge wrote:
I tried to install Ming
(http://sourceforge.net/projects/ming/)
on Windows to use with Python *but*
I can't [/don't know how to] use "make" to install it.
I installed MinGW on a Windows XP
Leif K-Brooks wrote:
John Bokma wrote:
my $sort = $cgi->param( "sort" );
my $query = "SELECT * FROM table WHERE id=? ORDER BY $sort";
And the equivalent Python code:
cursor.execute('SELECT * FROM table WHERE id=%%s ORDER BY %s' % sort,
[some_id])
You're right, of course, about being *able* to wr
I hope this is what you need, sometimes understanding the question is
one of the hardest parts :-)
If you can use a graph data structure, you can create a graph, and then
you can find the lenght of all its connected components (indentations
reduced to 2 spaces):
. def mat2graph(g, m, good=None, w
I have a string fetched from database, in iso8859-2, with 8bit
characters, and I'm trying to send it over the network, via a socket:
File "E:\Python24\lib\socket.py", line 249, in write
data = str(data) # XXX Should really reject non-string non-buffers
UnicodeEncodeError: 'ascii' codec can'
John Bokma <[EMAIL PROTECTED]> writes:
> Mike Meyer wrote:
>
>> "Simon John" <[EMAIL PROTECTED]> writes:
>>
>>> I still love Perl, it's a bit of an art form, as "there's more than
>>> one way to do it", whereas Python usually only allows one way to do
>>> it, which may or may not be a better mant
Howdy,
This may not belong here, if so apologies...
I'm a python newbie, but have completed a console app that I'd like to run
under X. Reading recent postings here, wxpython seemed a reasonable choice so
under debian sid, I installed (via apt-get) the various wxpython stuff
available.:
libwx
The Great jeff elkins uttered these words on 4/23/2005 5:45 PM:
test.py crashes with the error below. Any clues?
===
Running test.py:
Traceback (most recent call last):
File "./test.py", line 87, in ?
app = MyApp(0) # Create an instance of the application class
File "/usr/l
Peter Ammon wrote:
I'm bewildered why you haven't mentioned magic quotes. A one line
change to the configuration file can render your PHP site almost
entirely immune to SQL injection attacks.
PHP's magic quotes is one of the most poorly-designed features I can
think of. Instead of magically esc
On Sun, 24 Apr 2005 03:15:02 +0200, Ivan Voras <[EMAIL PROTECTED]> wrote:
I have a string fetched from database, in iso8859-2, with 8bit characters,
and I'm trying to send it over the network, via a socket:
You don't have a string fetched from a database, in iso-8859-2, alas.
That is the root o
I need to write a "fast" file reader in python for binary files structured as:
… x[0] y[0] z[0] x[1] y[1] z[1] …
where c[k] is the k-th element from sequence c. As mentioned, the
file is binary -- spaces above are just for visualization. Each
element, c[k], is a 16-bit int. I can assume I kno
Ivan Voras wrote:
I have a string fetched from database, in iso8859-2, with 8bit
characters, and I'm trying to send it over the network, via a socket:
File "E:\Python24\lib\socket.py", line 249, in write
data = str(data) # XXX Should really reject non-string non-buffers
UnicodeEncodeError:
To All:
Folks, I need your help. I have a friend who claims that if I write:
foo = 5
then foo is NOT a variable, necessarily. If you guys can define for me
what a variable is and what qualifications you have to back you, I can
pass this along to, hopefully, convince him that foo is indeed a va
I think, strictly speaking, foo would be a "name" in python.
>>> foo
Traceback (most recent call last):
File "", line 1, in ?
NameError: name 'foo' is not defined
On Saturday 23 April 2005 07:20 pm, so sayeth Richard Blackwood:
> To All:
>
> Folks, I need your help. I have a friend who cl
1 - 100 of 128 matches
Mail list logo