Thanks guys,
In the example the __call__ method has *args and **kws as arguments. Is that
required?
Also when, in what situation would you use callable objects?
Cheers,
T
Original-Nachricht
Datum: Wed, 15 Jul 2009 12:02:05 -0700
Von: wesley chun wes...@gmail.com
An: vince
no the __call__ function can is like any function
def __call__(self, passedin):
or simply
def __call__(self)
*args and **kws explained http://www.saltycrane.com/blog/2008/01/how-to-
use-args-and-kwargs-in-python/
On Thursday 16 July 2009 12:09:52 am Todd Matsumoto wrote:
Thanks guys,
You need to read what dictionaries are.
Essentially, any time you think oh I need to keep separate variables
for these values, but I won't know what their names are until
runtime! the correct answer is to not try to manipulate them into
variables, but to use them as dictionary keys, or organize
Hi,
My question is more about style/timing than anything else.
In my program I'm taking a word and generating blanks in that word. For
example, the word cat could generate:
_at
c_t
ca_
I have two different ways I can put _ in the word:
word = 'cat'
''.join(list(word)[1] = '_')
and
# I'm not
Wayne wrote:
Hi,
My question is more about style/timing than anything else.
In my program I'm taking a word and generating blanks in that word.
For example, the word cat could generate:
_at
c_t
ca_
I have two different ways I can put _ in the word:
word = 'cat'
''.join(list(word)[1] = '_')
Chris Castillo wrote:
why does your 3rd and fourth lines have brackets?
On Thu, Jul 16, 2009 at 1:08 AM, Christian Witts
cwi...@compuscan.co.za mailto:cwi...@compuscan.co.za wrote:
Chris Castillo wrote:
I'm having some trouble reading multiple data types from a
single
Wayne wrote:
On Thu, Jul 16, 2009 at 4:06 AM, Christian Witts
cwi...@compuscan.co.za mailto:cwi...@compuscan.co.za wrote:
snip
Strings are essentially a list already of characters. What would
be slowing down your preferred method #1 would be your explicit
cast to a list and
Christian Witts schrieb:
Wayne wrote:
Hi,
...
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
Strings are essentially a list already
Hi,
a new question usually merits a new thread. Especially after a longer time,
replies to older threads tend to remain unread as people simply don't
scroll down far enough to notice them.
You were lucky. :)
Johan Geldenhuys wrote:
I have another question about writing the xml tree to a file.
Chris Castillo wrote:
Oh okay. gotcha.
so I have what I want basically. I just need to check to see if each
number meets a certain criteria and output something like the
following to a text file. Should I be going about this a different way
or should I still use lists?
bob below average
2009/7/16 Eduardo Vieira eduardo.su...@gmail.com:
Hello, I have a file that was a resulted from a POS-Tagging program,
after some transformations, I wanted to restore to it's normal form.
So, I used sed to remove the POS-Tags and have something like this:
Please show us some output from the
On Thu, Jul 16, 2009 at 11:22 AM, Gregor Linglgregor.li...@aon.at wrote:
That's simply not true in Python. Try it out!
word = cat
word[1] = _
Traceback (most recent call last):
File pyshell#1, line 1, in module
word[1] = _
TypeError: 'str' object does not support item assignment
And
From: chris Hynes cjhyne...@hotmail.com
Date: 2009/7/15
Subject: The why
To: roadier...@googlemail.com
Well, I'm trying to create an interactive program, let's say I'm
running the program, I ask the user to give the array a name, I then
do some computations and store the results in that
On Thu, Jul 16, 2009 at 4:29 AM, Waynesri...@gmail.com wrote:
Hi,
My question is more about style/timing than anything else.
In my program I'm taking a word and generating blanks in that word. For
example, the word cat could generate:
_at
c_t
ca_
I have two different ways I can put _ in
2009/7/16 amr...@iisermohali.ac.in:
Thanks for your help I tried your commands like:---
from __future__ import with_statement #only works on version 2.5 and later
from collections import defaultdict
from decimal import Decimal
atoms = defaultdict(dict)
with open(file1.txt) as f:
for
Please use reply-all, so that emails go to the list as well.
2009/7/16 amr...@iisermohali.ac.in:
Thankyou for help it is working and giving the result but the only problem
is that it is making a very big file as it is searching for each position
of ALA and first writting its C value then CA
On Thu, Jul 16, 2009 at 5:50 AM, Kent Johnson ken...@tds.net wrote:
On Thu, Jul 16, 2009 at 4:29 AM, Waynesri...@gmail.com wrote: I have
two different ways I can put _ in the word:
word = 'cat'
''.join(list(word)[1] = '_')
Not in any Python I ever used...
In [1]: word = 'cat'
In [2]:
Yeah, I'm not sure if I'm explaining myself well or maybe I'm just trying to
make the code too interactive.
in my code I would type something like:
x=zeros((3,3))
so the pointer called x is created by the programmer, but within the code.
What if I wanted to prompt my keyboard user to type in
Thanks Stefan (decided to continue with a new thread name),
I basically wants to create a loop that creates a tree, appends it to the
previous tree and write it all to one file...If that makes sense.
At the moment my tree is something like this:
Signal name=abcde
Johan Geldenhuys wrote:
Thanks Stefan (decided to continue with a new thread name),
... which isn't quite enough. As long as you reply to the mail, e-mail/news
readers will still sort it into the original thread, so many people will
not see it.
I basically wants to create a loop that creates
All lines that come back from a text file come back as strings. You can use
string methods to detect the data like so:
f = open('test.txt')
lines = f.readlines()
numbers = []
strings = []
for line in lines:
if line.strip().isdigit():
numbers.append(int(line))
else:
On Thu, Jul 16, 2009 at 9:38 AM, chris Hynes cjhyne...@hotmail.com wrote:
Yeah, I'm not sure if I'm explaining myself well or maybe I'm just trying
to make the code too interactive.
in my code I would type something like:
x=zeros((3,3))
so the pointer called x is created by the
Thankyou very much sir now it is working..it is giving that result
which i wanted. Thankyou very much..
Thanks,
Amrita
Please use reply-all, so that emails go to the list as well.
2009/7/16 amr...@iisermohali.ac.in:
Thankyou for help it is working and giving the result but
chris Hynes cjhyne...@hotmail.com wrote
I want the user to input a name, say Chris. I know I can use the code:
name=raw_input()
I now want:
Chris=zeros((3,3))
so that when I type:
print Chris
This is a common misapprehension by beginners.
But let me ask you something. Since you will
*so far I have this and the format is what i want:*
--
# Set all necessary variables
name = None
fileOut = open('outputFile.txt', 'w')
total = 0
averageScore = 0
numofScores = 0
score = 0
# Header for output
That's just it, you won't know in advance what names the user will type in.
Maybe I mean to say dynamically create pointers. For instance,
In the morning, I might be working with data regarding methanol and do several
iterations and save those iterations in separate arrays with some type of
jonathan wallis wrote:
i have a duel loop that looks like thiswhile y 0 and x 0:
i cant figure out if there is a way to make so if one loop ends it says
something different than if the other loop ends.
while x 0 or y 0:
...
if x 0:
print 'x is greater than 0'
elif y
Hi, well mabe it's not so complex (just for me).
I have this code which works fine:
#start###
from pyparsing import *
data = 23 different size pry bars
hammer the pitchfork
pound felt paper staple the felt paper every to inches staple
Hello, I'm scratching my head into solving a problem of transforming a
POS-Tagged text in a normal text. My biggest problem is that I can't
get the quotes to be placed properly.
I had tried a different approach but was advised in the nltk list to
use this example, but it does not solve the quoting
Chris Castillo wrote:
*so far I have this and the format is what i want:*
--
# Set all necessary variables
name = None
fileOut = open('outputFile.txt', 'w')
total = 0
averageScore = 0
numofScores = 0
score =
Wayne wrote:
On Thu, Jul 16, 2009 at 9:38 AM, chris Hynes cjhyne...@hotmail.com
mailto:cjhyne...@hotmail.com wrote:
Yeah, I'm not sure if I'm explaining myself well or maybe I'm just
trying to make the code too interactive.
in my code I would type something like:
jonathan wallis mindboggle...@gmail.com wrote
i have a duel loop that looks like this
while y 0 and x 0:
This is not any kind of loop its a while expression.
It should have a body and that would then constitute
a single while loop not a dual loop ( a duel lop has
something
Pedro -
If you are trying to extract a simple pattern like a numeric word followed
by an alpha word, I would suggest using one of the scanString or
searchString methods. scanString is probably the better choice, since you
seem to need not only the matching tokens, but also the location within
Todd Matsumoto wrote:
Hi,
Thanks for all the comments so far.
DaveA, I'm receiving the value via pyODBC, after running a query on a database.
The test is to first make sure the value is a Decimal (pyODBC returns a Decimal
object if what is coming from the database is a decimal type). So if I
Hi Paul. Thanks. I would like to get better at pyparsing. Can you
recommend a good resource for learning. I am finding that what info I
have found on the subject (on the web) isn't really explaining it from
the ground up as much as I would like.
Cheers
Pete
chris Hynes wrote:
That's just it, you won't know in advance what names the user will type in.
Maybe I mean to say dynamically create pointers. For instance,
In the morning, I might be working with data regarding methanol and do several iterations and save those iterations in separate arrays
Hi,
I am interested in gathering simple weather data using Beautiful Soup, but am
having trouble understanding what I'm doing. I have searched the archives and
so far haven't found enough to get me moving forward.
Basically I am trying to start off this example:
Grabbing Weather
Hi Paul. Thanks. I would like to get better at pyparsing. Can you
recommend a good resource for learning. I am finding that what info I
have found on the subject (on the web) isn't really explaining it from
the ground up as much as I would like.
Hrmmm, not sure what to recommend - I might
38 matches
Mail list logo