module.
If I can't find another solution, I think I will downgrade the MySQLdb
version to 1.2.1
Cyril
On Thu, Jul 17, 2008 at 7:27 AM, Lawrence D'Oliveiro
[EMAIL PROTECTED] wrote:
In message [EMAIL PROTECTED], Cyril Bazin
wrote:
But it seems, after many tests, that the script stops
MySQLdb
MySQLdb.__version__
'1.2.2'
import mod_python
mod_python.version
'3.3.1'
-
If someone has any information that can help me...
Thanks in advance,
Cyril BAZIN
--
http://mail.python.org/mailman/listinfo/python-list
look at the modules urllib and urllib2, they both are provided with python : http://docs.python.org/lib/module-urllib.html
http://docs.python.org/lib/module-urllib2.htmlAnd look at the examples :http://docs.python.org/lib/node483.html
http://docs.python.org/lib/urllib2-examples.htmlOn 23 Aug 2006
Look at boost and boost.python . In your case, bosst.python seems more interesting, but you take a look at boost it may help you at work... http://www.boost.org/
http://www.boost.org/libs/python/doc/CyrilOn 23 Aug 2006 07:19:42 -0700, Will McGugan [EMAIL PROTECTED]
wrote:Hi folks,I'm forced to
Postgis is only an extension of Postgres which add new classes and new operations specialised for GIS.
All you should know, is how to build SQL requests for postgres...
If you want to be familiarised with the GIS, you should try to make your own little project.
So you will be able to ask more
Now, you can try laszlo in 10 minutes http://www.laszlosystems.com/lps/laszlo-in-ten-minutes/ .
Reference: http://www.openlaszlo.org/
--
http://mail.python.org/mailman/listinfo/python-list
On 3/6/06, Bryan Olson [EMAIL PROTECTED] wrote:
Peter Hansen wrote: The archives could tell you more, but basically on is usually interested in *identity* with a singleton object (None), not in whether the object on is examining happens to compare equal.A custom object could be
designed to
Your file looks like a list of IP adresses. You can use the urllib and urllib2 modules to parse IP adresses.import urllib2for line in open(fileName.txt): addr, port = urllib2.splitport(line)
print (port != None) and '' or portCyril
--
http://mail.python.org/mailman/listinfo/python-list
] wrote:
Cyril Bazin wrote: Your file looks like a list of IP adresses. You can use the urllib and urllib2 modules to parse IP adresses. import urllib2 for line in open(fileName.txt):
addr, port= urllib2.splitport(line) print (port != None) and '' or portIs this what you want to happen when port
What about that?
SomeNumbers = enum('0', '1', '2', '3', '4', '5', '6', '7')
or
Rooms = enum('1bed', '2beds', 'moreThan2beds')
or even
Comments = enum('#', ';', '//')
CyrilOn 28 Feb 2006 03:14:25 -0800, Carl Banks [EMAIL PROTECTED] wrote:
Stefan Rank wrote: on 28.02.2006 07:50 Carl Banks
Are you looking for the map function?
def f(x): return x+4
map(f, [1,2,3,3,70])
[5, 6, 7, 7, 74]
CyrilOn 2/28/06, Ronny Mandal [EMAIL PROTECTED] wrote:
Assume you have a mathematical function, e.g. f(x) = x + 4To calculate all the values from 1 to n, a loop is one alternative.But to make this
Does someone ever tried (and succeed) to make an address like www.website.py.I found that the .py extension is given to the paraguay.I found this link (
http://www.nic.py/) but I don't speak spanish... If someone has more informations...Cyril
--
http://mail.python.org/mailman/listinfo/python-list
I added my own function to the benchmark of Robin Becker:from itertools import chaindef flatten9(x, y): return list(chain(*izip(x, y)))Results:
no psyco Name 10 20100200500 1000
flatten1104.499199.699854.301 1673.102 4084.301 8078.504
flatten2111.103204.706944.901 1778.793 4554.701 8773.494
Another try:
def flatten6(x, y):
return list(chain(*izip(x, y)))
(any case, this is shorter ;-)
Cyril
On 1/12/06, Michael Spencer [EMAIL PROTECTED] wrote:
Tim Hochberg wrote:
Michael Spencer wrote:
Robin Becker schrieb:
Is there some smart/fast way to flatten a level one list
Hello,
b = [[] for _ in xrange(6)] # - note the xrange!
b[3].append('X')
b
[[], [], [], ['X'], [], []]
This syntax might be less hairy but could be better when you use large table.
You can hide this syntax by making a function:
def buildMatrix(nbRows):
return [[] for _ in xrange(nbRows)]
Here is an example of copying then reversing a list:
l1 = [1,2,C]
l2 = l1[:]
l2.reverse()
l2
['C', 2, 1]
--
http://mail.python.org/mailman/listinfo/python-list
Hello,
I need to compute eigenvalues and eigenvectors on sparse matrix.
I found a C library meschach which seems to do the work.
Unfortunatly, this libray doesn't seem to be interfaced in Python.
Has anyone ever used this library and interfaced it in Python or has a solution
to compute
Crypthonic could be the exact word...On 29 Sep 2005 15:19:11 +0100, Peter Corbett [EMAIL PROTECTED]
wrote:Richie Hindle [EMAIL PROTECTED]
writes: [Peter] http://www.pick.ucam.org/~ptc24/yvfc.html [Jeff] Yuma Valley Agricultural Center?
Yaak Valley Forest Council? I went through the same
Try the code below.
#-
list=[airplane,car,boat]
select = None
while select not in list:
select=raw_input(Which vehicle?)#-
Cyril
On 8/20/05, Viper Jack [EMAIL PROTECTED] wrote:
Hi all,i'm new to
Try Image.new in place of Image.Image if you want to build a new image.
At which level are you?
CyrilOn 14 Aug 2005 10:34:38 -0700, Ray [EMAIL PROTECTED] wrote:
Hello,I'm using latest PIL version with Python 2.4.1. (for solving a level inPython Challenge actually...). Anyway, I'm trying to draw
Maybe simpler but not very much simpler: one line for each solution.
And in your solution the lambda is evaluated at each comparaison of the sort algorithm isn't it?
So your code seems less productive than the bengt's code which apply
the same code as the lambda only one time by entry in the
I think bs = BeautifulSoup.BeautifulSoup( oFile) but I don't understand what you are doing...
(I never used BeautifulSoup...)
Maybe It is somthing like:
import itertools
for incident in itertools.chain(bs('tr',{'bgcolor' : '#ee'}), bs('tr',{'bgcolor' : 'white'})):
do_something()
Look at
Another solution derived from an old discussion about the same problem?
def takeBy(s, n):
import itertools
list(''.join(x) for x in itertools.izip(*[iter(s)]*n))
(Hoping len(s) % n = 0)
CyrilOn 8 Aug 2005 11:04:31 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:Yes i know i made a
Hello,
I propose 3 solutions. If someone have time to waste, he can make a
benchmark to know which is the fastest and give us the results on the
list.
Solution 1:
import itertools
c = [a_i-b_i for a_i, b_i in itertools.izip(a, b)]
Solution 2:
c = map(operator.sub, a, b)
#map will be removed
By any chance are you speaking about the function repr ?
Cyril
On 24 Jul 2005 18:14:13 -0700, ncf [EMAIL PROTECTED] wrote:
I know I've seen this somewhere before, but does anyone know what thefunction to escape a string is? (i.e., encoding newline to \n and achr(254) to \xfe) (and
Maybe in certain case you could use hash to compare objects (hashable
of course) quicker by comparing there hash values, if the hash values
are the same you test the equality between the objects.
But the sets and dicts cover the greatest part of the use of hash.
(Personally, I never used that
Fine,
Go to http://www.pythonchallenge.com and try the challenge, if you
are able to get to the level 17-18, you can say you start to have good
skills in Python. You will prove:
you are not stupid,
you know regex, basic sound/image treatment, the basics of zip/bz2, you
understood how to use
The question of the type of the data sutructure depends of your use of the data.
You could avoid some confusion without naming your columns lines...
Anyway, here is a piece of code that read the file and count the star on the fly:
(The result is a dict of dict of int.)
Glauco,
Be careful if you decide to use hash.
There is possibility of bugs due to that approach, (if hash(x) == hash(y) and x != y).
Even if the probability of bug is near 0, your computer will certainly recall you what is the murphy law.
If I were you, I would prefer another approach.
Cyril
Hello,
I never used a web framework using Python modules, but I think cheetah,
Karrigel and CherryPy are not good since they allow user to play with
the HTML code. IMO, it's not pythonic but phpythonic.
Isn't there a python framework inspirated by the Smalltalk framework Seaside?
I think it's
I think hash doesn't guarantee the unicity of the result. But, it should avoid the collisions...
foo = foo
hash(foo)
-740391237
hash(-740391237)
-740391237
I think it's like some kind md5sum...
I propose this solution:
---
from
if t is your data, you can use:
l1, l2 = zip(*t)
Cyril
On 7/14/05, Richard [EMAIL PROTECTED] wrote:
I have a large list of two element tuples.I want two separatelists: One list with the first element of every tuple, and thesecond list with the second element of every tuple.Each tuple contains a
If that can help you...
def replaceLastComma(s):
i = s.rindex(,)
return ' and'.join([s[:i], s[i+1:]])
I don't know of ot's better to do a:
' and'.join([s[:i], s[i+1:]])
Or:
''.join([s[:i], ' and', s[i+1:]])
Or:
s[:i] + ' and' + s[i+1]
Maybe the better solution is not in the list...
Cyril
On
Im my opinion, class method are used to store some functions related to a class in the scope of the class.
For example, I often use static methods like that:
class Foo:
On 7/12/05, Steven D'Aprano [EMAIL PROTECTED] wrote:
I've been doing a lot of reading about static methods in Python, and
(sorry, my fingers send the mail by there own ;-)
Im my opinion, class method are used to store some functionalities (function) related to a class in the scope of the class.
For example, I often use static methods like that:
class Point:
def __init__(self, x, y):
self.x, self.y = x, y
def
a string of length 1 and return a parser of char.
'txt' is a function that take a string of any length and return a parser.
I hope it is a better example!
That one of the rare case I used static method in Python...
Cyril
On 7/12/05, Robert Kern [EMAIL PROTECTED] wrote:
Cyril Bazin wrote: (sorry
Hello,
Try that, it may not be the better solution, but it seems to work:
#def invertDict(d):
# d2 = {}
# for k, v in d.iteritems():
# d2.setdefault(v, []).append(k)
# return d2
Cyril
On 7/11/05, Ric Da Force [EMAIL PROTECTED] wrote:
Hi all,I have a dictionary containing about 300 items, some
Hum... I think an iteritems is better, this way, python don't need to create in memory
a complete list of couple key, value.On 7/11/05, Markus Weihs [EMAIL PROTECTED] wrote:
Hi! Dict = {'rt': 'repeated', 'sr':'repeated', 'gf':'not repeated'} NewDic = {} for k,v in Dict.items():
2005 20:31:06 +0200, Cyril BAZIN [EMAIL PROTECTED]
declaimed the following in comp.lang.python:
def toTable(n1, n2, n3):
return %20s%20s%20s%tuple([%.12f%x for x in [n1, n2, n3]])
Ugh...
def toTable(*ns):
return (%20.12f * len(ns)) % ns
toTable(3.14, 10.0, 3, 4
Hello,
I don't anderstand very well Fortran syntax, but want you say
something like that:
def toTable(n1, n2, n3):
return %20s%20s%20s%tuple([%.12f%x for x in [n1, n2, n3]])
Example:
import math
toTable(math.pi, 10, 8.2323)
' 3.141592653590 10. 8.2323'
If you are looking for HTML tags or something like that. Have a look
at the HTMLParser (docs.python.org).
On 4 Jul 2005 03:37:02 -0700, jwaixs [EMAIL PROTECTED] wrote:
Thank you for your replies, it's much obvious now. I know more what I
can and can't do with the re module. But is it possible
Hello,
If you have enough money to buy a licence, Visual Basic seem a very good option.
(But you should learn how to use design patterns.)
Without knowing this language I was able to perform a graphical user interface to
interact with an automat, a mySQL database and many analogical sensors in
Hello,
I am looking for a geometry library for Python.
I want to make some computations like:
-distance between vertex and polygon, vertex and polyline, vertex and segment, etc
-if a point is inside a polygon, if a polyline intersect a polygon, etc
Thanks for your help,
Cyril
--
Hi,
I don't know very well what you want to do, but if you want to parse
c++, take a look at GCC-XML python (http://www.gccxml.org) and the
python binding (http://pygccxml.sourceforge.net/). These tools
translate c++ code to XML. Then, you can parse xml with your favorite
tools and find the
Just another solution, pretty and effective:
def fct(a, b):
idx = -1
for c in a:
idx = b.find(c, idx+1)
if idx == -1:
return False
return True
On 24 May 2005 06:06:03 -0700, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:thanx everyone, is what i need.As Claudio argues, it's a standard problem
c=2
e=3
s=12
code.append('funtion (c, e,s)')
print \n.join(code) + '\n'
Hello,
You could try this:
---
from string import Template
code =
c=2
e=3
s=12
code.append(Template('function ($c, $e, $s)').substitute(vars()))
print \n.join(code) + '\n'
Hello John,
Try your python code on this example:
merge([[1,2], [3,4], [1,2], [5,3]])
The result given by your function is:
[[3, 4, 5]]
Sorry...
To Xah: next time you propose an exercise, write some UNIT TESTS!!!
Then people will be able to test if there answers are correct or not.
Cyril
Hello,
I want to build a function which return values which appear two or
more times in a list:
So, I decided to write a little example which doesn't work:
#l = [1, 7, 3, 4, 3, 2, 1]
#i = iter(l)
#for x in i:
#j = iter(i)
#for y in j:
#if x == y:
#print x
In thinked
48 matches
Mail list logo