[EMAIL PROTECTED] a écrit :
On Dec 21, 9:11 am, SMALLp [EMAIL PROTECTED] wrote:
(snip)
class insertData:
def insert(self, dataTable, data):
(snip)
I think you need to post the real traceback or the real code since
your error message doesn't look like it has anything to do with the
SMALLp a écrit :
(snip)
One more question. How does my code looks like. I couldn't find any open
source program written in python
You must be jocking ?
--
http://mail.python.org/mailman/listinfo/python-list
Thank you for all your help!
I'll study the proposals to chose the one I prefer or to create
something new :) Anyway, this is a perfect start-up for me.
Nathaniel.
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
Hello :)
I am new to python and I don't have much expirience in object-oriented
technologies neither.
The problem is the following: I have to create a simple python
template script that will always follow the same algorithm, let's say:
- read a mesh
- transform
On May 14, 7:09 am, [EMAIL PROTECTED] wrote:
Hello :)
I am new to python and I don't have much expirience in object-oriented
technologies neither.
The problem is the following: I have to create a simple python
template script that will always follow the same algorithm, let's say:
- read a
On May 19, 10:45 am, 7stud [EMAIL PROTECTED] wrote:
refineModule.py:
---
def refine(userfunc, mesh):
#process mesh
func(mesh)
The last line should be:
userfunc(mesh)
--
http://mail.python.org/mailman/listinfo/python-list
On May 14, 9:09 am, [EMAIL PROTECTED] wrote:
Hello :)
I am new to python and I don't have much expirience in object-oriented
technologies neither.
The problem is the following: I have to create a simple python
template script that will always follow the same algorithm, let's say:
- read a
En Sun, 29 Apr 2007 22:50:59 -0300, Teresa Hardy [EMAIL PROTECTED]
escribió:
I have successfully made the threading work on a Window XP machine with
quad
processors but now I am trying to pass some variables around and am
fighting
with Lock()
If there is the possibility that the same
On Mar 14, 3:46 pm, KDawg44 [EMAIL PROTECTED] wrote:
I am trying to learn python. I am working through a tutorial on
python.org. I am trying to figure out how lists are different than
tuples other than changing values at specific indices.
You can change lists but not tuples. That has some
KDawg44 a écrit :
Hi,
I am trying to learn python. I am working through a tutorial on
python.org. I am trying to figure out how lists are different than
tuples other than changing values at specific indices.
Harold To illustrate, assume I have a text file, call it test.txt, with
Harold the following information:
Harold X11 .32
Harold X22 .45
Harold My goal in the python program is to manipulate this file such
Harold that a new file would be created that looks like:
erik gartz [EMAIL PROTECTED] writes:
Doesn't {} allocate new memory for the dictionary each time? It
almost appears as if the 2nd dictionary created overwrites the first
one.
URL:http://effbot.org/pyfaq/how-do-i-create-a-multidimensional-list.htm
--
\There are only two ways to
erik gartz wrote:
I'm new to python and I'm having difficulty understanding the following
code. Why doesn't the variable a contain [[{}, {'x': 0}, {}], [{},
{'x': 1}, {}]] instead. Doesn't {} allocate new memory for the
dictionary each time?
each time it's *executed*, yes. [{}]*3 doesn't
Ángel Gutiérrez Rodríguez wrote:
The problem:
I have two classes:
class X:
def __init__(self):
pass
class Y:
def __init__(self):
self.a=1
self.b=X()
and I would like to make 'a' visible inside 'x'. Is there a way to refer
to the Y class from the X? To make
Dennis Lee Bieber wrote:
On Wed, 28 Jun 2006 10:35:10 +0200, Diez B. Roggisch
[EMAIL PROTECTED] declaimed the following in comp.lang.python:
class X:
def __init__(self, my_y):
self.my_y
self.my_y = my_y
*argl*
Thanks :)
No tea so far...
Diez
--
That wa sneat! Thanks!
--
Ángel Gutiérrez Rodríguez - [EMAIL PROTECTED]
Instituto de Ciencia de los Materiales de Madrid - CSIC
SpLine - European Syncrothorn Radiation Facility - Grenoble - France
Postal adress: Departamento de Química Física y Analítica
Universidad de Oviedo - c/Julián
Luke wrote:
I'm pretty stuck at the moment and wondering if anyone can spot the problem.
Trying to create a function that will read a text file into a list and
return that list.
I wrote the following function and saved it as 'fileloader.py'
def fileload(fname):
infile=open(fname)
Luke wrote:
I'm pretty stuck at the moment and wondering if anyone can spot the problem.
Trying to create a function that will read a text file into a list and
return that list.
I wrote the following function and saved it as 'fileloader.py'
def fileload(fname):
infile=open(fname)
Thanks to both of you for the help, much appreciated!
Luke
--
http://mail.python.org/mailman/listinfo/python-list
Sandro Dentella [EMAIL PROTECTED] wrote:
I need to build-up an arg list to pass to a function.
Suppose I have a dictionary:
opts = { 'user' : 'jack', 'addr' : 'Green Str.'}
and I want to build a cmd line like this:
select( user='jack', addr='Green Str.' )
select(**opts)
should
Joon wrote:
# Fibonacci series:
... # the sum of two elements defines the next
... a, b = 0, 1
while b 10:
... print b
... a, b = b, a+b
...
1
1
2
3
5
8
a, b = 0, 1
while b 10:
print b
a = b
b = a+b
1
2
4
8
Why a, b = b,
Joon wrote:
a, b = 0, 1
while b 10:
print b
a = b
b = a+b
1
2
4
8
Why a, b = b, a+b isn't a = b; b = a+b ?
Because you changed a before you added it to b.
Let's call your existing a and b a0 and b0, and the next a and b
a1 and b1. When you do a, b = b, a+b
The case is that Python in attribution commands solves first the right
side, so he atributes the vars.
So the a+b expression is executed first.
Joon escreveu:
# Fibonacci series:
... # the sum of two elements defines the next
... a, b = 0, 1
while b 10:
... print b
... a, b
Yes, i see.
Thank you very much for the fast help!
--
http://mail.python.org/mailman/listinfo/python-list
Steve -
Good catch - in v1.3, I added some Unicode support for pyparsing,
although I have not gotten much feedback that anyone is using it, or
how well it works. So it is preferable to test against basestring
instead of str.
-- Paul
--
http://mail.python.org/mailman/listinfo/python-list
[EMAIL PROTECTED] wrote:
Hi,
Thanks for your reply! A new thing learned
Allow me to follow that up with another question:
Let's say I have a result from a module called pyparsing:
Results1 = ['abc', 'def']
Results2 = ['abc']
They are of the ParseResults type:
type(Results1)
Reinhold Birkenfeld [EMAIL PROTECTED] wrote in
message news:[EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
Hi,
Thanks for your reply! A new thing learned
Allow me to follow that up with another question:
Let's say I have a result from a module called pyparsing:
Results1 = ['abc', 'def']
David -
I'm not getting the same results. Run this test program:
---
import pyparsing as pp
import sys
def test(s):
results = pp.OneOrMore( pp.Word(pp.alphas) ).parseString( s )
print repr(s),-,list(results)
print Python version:, sys.version
print pyparsing version:,
John -
I just modified my test program BNF to use ZeroOrMore instead of
OneOrMore, and parsed an empty string. Calling list() on the returned
results gives an empty list. What version of pyparsing are you seeing
this None/object/list behavior?
-- Paul
--
On Mon, Jun 27, 2005 at 08:21:41AM -0600, John Roth wrote:
Unfortunately, I've seen that behavior a number of times:
no output is None, one output is the object, more than one
is a list of objects. That forces you to have checks for None
and list types all over the place.
maybe you can at
Modified version of test program, to handle empty strings - empty
lists.
import pyparsing as pp
import sys
def test(s):
results = pp.ZeroOrMore( pp.Word(pp.alphas) ).parseString( s )
print repr(s),-,list(results)
print Python version:, sys.version
print pyparsing version:,
Hi Paul and everyone else,
I ran the script and here's what I got:
Python version: 2.4.1 (#2, Mar 31 2005, 00:05:10)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1666)]
pyparsing version: 1.3
'abc def' - ['abc', 'def']
'abc' - ['abc']
It seems to work fine.
I figured out what my problem was:
[EMAIL PROTECTED] wrote:
if type(input) == str:
You might consider writing this as:
if isinstance(input, basestring):
I don't know if pyparsing ever produces unicode objects, but in case it
does (or it starts to in the future), isinstance is a better call here.
STeVe
--
('abc') is not a tuple - this is an unfortunate result of using ()'s as
expression grouping *and* as tuple delimiters. To make ('abc') a
tuple, you must add an extra comma, as ('abc',).
list( ('abc',) )
['abc']
-- Paul
--
http://mail.python.org/mailman/listinfo/python-list
Hi,
Thanks for your reply! A new thing learned
Allow me to follow that up with another question:
Let's say I have a result from a module called pyparsing:
Results1 = ['abc', 'def']
Results2 = ['abc']
They are of the ParseResults type:
type(Results1)
class 'pyparsing.ParseResults'
Robert Kern wrote:
Greg Ewing wrote:
[about the from xxx import * syntax]
Better still, don't even *mention* it to a beginner.
They don't need to know about it. At all. Really.
Well, the OP's use is precisely why from xxx import * exists: the
interactive prompt.
In that case (and, really,
Elliot Temple wrote:
from math import *
log10(15625)
It's always a good idea, especially when answering a beginner's
question, to add the caution that this form (from xxx import *) has
certain dangers** associated with it, and is widely considered poor
style, and should really only rarely be
import math
math.log10(15625)
To find out the names of function in the math module without checking the
docs, do
dir(math) #same for any other module
To get more info, do
help(math) # same for any other module with a doc string
Terry J. Reedy
--
Peter Hansen [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Elliot Temple wrote:
from math import *
log10(15625)
It's always a good idea, especially when answering a beginner's
question, to add the caution that this form (from xxx import *) has
certain dangers** associated with
Peter Hansen wrote:
It's always a good idea, especially when answering a beginner's
question, to add the caution that this form (from xxx import *) has
certain dangers** associated with it, and is widely considered poor
style, and should really only rarely be used.
Better still, don't
Greg Ewing wrote:
Peter Hansen wrote:
It's always a good idea, especially when answering a beginner's
question, to add the caution that this form (from xxx import *) has
certain dangers** associated with it, and is widely considered poor
style, and should really only rarely be used.
Svens wrote:
Hey everyone! I'm a math student working on a short script involving
logs. I have a function on my scientific calculator, and was wondering
if there was a similar funtion in python.
For example:
(log65536)/(log4)= 8
I've searched around a bit and haven't been able to find
Hey thanks...
Still getting an error message though. Here's what i'm doing:
--
import math
log10(15625)
--
-It says that log10 is not defined, but it is since the module is
imported, right?
--
http://mail.python.org/mailman/listinfo/python-list
Svens wrote:
Hey thanks...
Still getting an error message though. Here's what i'm doing:
--
import math
log10(15625)
--
-It says that log10 is not defined, but it is since the module is
imported, right?
No, read the tutorial.
import math
math.log10(15625)
--
Robert Kern
Svens wrote:
Hey thanks...
Still getting an error message though. Here's what i'm doing:
--
import math
log10(15625)
--
-It says that log10 is not defined, but it is since the module is
imported, right?
try this:
import math
math.log10(15625)
--
On Jun 1, 2005, at 9:04 PM, Svens wrote:
Hey thanks...
Still getting an error message though. Here's what i'm doing:
--
import math
log10(15625)
--
-It says that log10 is not defined, but it is since the module is
imported, right?
do either
import math
math.log10(15625)
Uppal, Deepali wrote:
Hello,
Hello, and welcome to the world of Python. Don't take anything we say
too personally, it is meant to help.
I am facing a bit of a problem due to python implicitly
attaching a type to an object.
Ooh. In general, don't say 'implicit'. For the most part, Python
Thanks for the tip. I knew it was something easy like that.
Brian van den Broek [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
Todd_Calhoun said unto the world upon 2005-03-24 16:13:
I'm trying to generate a random number, and then concetate it to a word
to create a password.
str() returns a string, it doesn't change rannum which is still a number...
try -
rannum = str(rannum)
jw
On Thu, 24 Mar 2005 13:13:25 -0800, Todd_Calhoun [EMAIL PROTECTED] wrote:
I'm trying to generate a random number, and then concetate it to a word to
create a password.
I get the number
Todd_Calhoun said unto the world upon 2005-03-24 16:13:
I'm trying to generate a random number, and then concetate it to a word to
create a password.
I get the number and assign it to a variable:
+
word = dog
import random
rannum = random.randrange(100,999)
101 - 150 of 150 matches
Mail list logo