"Alex Hall" wrote
Alright, I have it working. Now the problem is that it does not
throw
out reversals. I tried to do this myself with a couple loops, but I
get index errors. My total list of permutations is called l.
for i in range(0, len(l)):
r=l[i]; r.reverse()
You don''t need to specify
"Dana" wrote
I'm using Python to extract words from plain text files. I have a
list of words. Now I would like to convert that list to a
dictionary of features where the key is the word and the value the
number of occurrences in a group of files based on the filename
I think I know what
>>> s = [.1,.1,.1,.1,.1,.1,.1,.1,.1,.1]
>>> sum(s)
0.
>>> print(sum(s))
1.0 Why?
>>> f = 0.
>>> f**100
0.9889
>>> print(f**100)
1.0 Why?
>>> f**1
0.99988898
>>> print(f**1)
0.
>>> from math import fsum
>>> fsum(s)
1.0
"Richard D. Moores" wrote
s = [.1,.1,.1,.1,.1,.1,.1,.1,.1,.1]
sum(s)
0.
This uses repr() to display the result
print(sum(s))
1.0 Why?
This uses str() to display the result.
In many cases str() calls repr() but in other cases str() is a more
user
friendly format.
Alex Hall wrote:
> 1. Order matters; I meant to say that direction does not. That is, 123
> is not the same as 213, but 123 is the same as 321 since the second
> example is simply a reversal.
> 2. I am looking for all permutations and subpermutations (if that is a
> word) of 1-n where the list mus
Following link could be useful:
http://stackoverflow.com/questions/104420/how-to-generate-all-permutations-of-a-list-in-python
On Thu, Dec 2, 2010 at 04:15, Alex Hall wrote:
> Hi all,
> I am wondering if there is a python package that will find
> permutations? For example, if I have (1, 2, 3),
Instead of nested fors which will grow exponentially in running time, consider
this for removing reversals:
newlist = []
tempdict = {}
for i in oldlist:
try:
tempdict[i]
except:
tempdict[i] = 1
tempdict[i.reverse()] = 1
newlist.append(i)
That's the gneral
Hi,
If you can get away with not telling me the answer, but pointing me to where to
look for the answer, I'd be grateful.
In my Python learning, I am just now starting to understand how to make classes
and extend them, so I have a very long way to go.
I wrote this code because I wanted to avoid
Here's your hint... to execute a Python function, it must be followed by
parentheses otherwise you are just referring to the function object.
HTH,
Vern
On Thu, Dec 2, 2010 at 9:35 AM, Homme, James wrote:
> Hi,
>
> If you can get away with not telling me the answer, but pointing me to
> whe
"Homme, James" wrote
If you can get away with not telling me the answer, but pointing
me to where to look for the answer, I'd be grateful.
OK, Don't use eval or exec they have secuity issues - especially if
reading the
strings from a file!
idea is to read in strings from a file, look one
Hi,
Is there any way I can use named tuples in Python 2.5? It's available since 2.6
and I'm not sure if from "__future__" works. I can't try it here.
I cannot simply upgrade Python (alas!)
http://www.python.org/doc//current/library/collections.html#collections.namedtuple
Cheers!!
Albert-Jan
On Thu, Dec 2, 2010 at 03:13, Alan Gauld wrote:
>
> "Richard D. Moores" wrote
>
> s = [.1,.1,.1,.1,.1,.1,.1,.1,.1,.1]
> sum(s)
>>
>> 0.
>
> This uses repr() to display the result
>
> print(sum(s))
>>
>> 1.0 Why?
>
> This uses str() to display the result.
>
> In ma
On 12/2/2010 9:52 AM Albert-Jan Roskam said...
Hi,
Is there any way I can use named tuples in Python 2.5? It's available since 2.6
and I'm not sure if from "__future__" works. I can't try it here.
I cannot simply upgrade Python (alas!)
Maybe this'll help...
http://code.activestate.com/recipes
Hi,
Thank you! Woaah, very cool code btw. There's much to learn from it, for me at
least.
Cheers!!
Albert-Jan
~~
All right, but apart from the sanitation, the medicine, education, wine, public
order, irrigation, roads, a fre
On 12/2/2010 2:09 PM, Richard D. Moores wrote:
[snip]
I found nothing that helped as much as you have already.
In the reference (for 2.6.2) under print statement I find:
"print evaluates each expression in turn and writes the resulting object
to standard output (see below). If an object is
bob gailer wrote:
On 12/2/2010 2:09 PM, Richard D. Moores wrote:
[snip]
I found nothing that helped as much as you have already.
In the reference (for 2.6.2) under print statement I find:
"print evaluates each expression in turn and writes the resulting object
to standard output (see below
I'm trying to build a program that reads in a file and copies specific
sections to a new file. More specifically, every time the words
"summary on" are in the original file, I want to copy the following
text to the new file until I get to the words "summary off".
My questions are the following:
1
On 12/2/2010 10:27 AM Ben Ganzfried said...
I'm trying to build a program that reads in a file and copies specific
sections to a new file. More specifically, every time the words
"summary on" are in the original file, I want to copy the following
text to the new file until I get to the words "su
Ben Ganzfried wrote:
I'm trying to build a program that reads in a file and copies specific
sections to a new file. More specifically, every time the words
"summary on" are in the original file, I want to copy the following
text to the new file until I get to the words "summary off".
My questio
"Ben Ganzfried" wrote
I'm trying to build a program that reads in a file and copies
specific
sections to a new file. More specifically, every time the words
"summary on" are in the original file, I want to copy the following
text to the new file until I get to the words "summary off".
This
Knacktus wrote:
Am 02.12.2010 02:51, schrieb Dana:
Hello,
I'm using Python to extract words from plain text files. I have a list
of words. Now I would like to convert that list to a dictionary of
features where the key is the word and the value the number of
occurrences in a group of files base
On Wed, 1 Dec 2010, Walter Prins wrote:
But whatever the case may be, suffice it to say I've reproduced your issue
on my Win7 64bit box, and then resolved it by installing the PyWin32
modules.
I'd like to put in a plug for Activestate Python here. Activestate has a
free distribution of Pytho
Alan Gauld wrote:
"Alex Hall" wrote
Alright, I have it working. Now the problem is that it does not throw
out reversals. I tried to do this myself with a couple loops, but I
get index errors. My total list of permutations is called l.
for i in range(0, len(l)):
r=l[i]; r.reverse()
You don'
I've been working on this cli based python 3.x app for a friends shop.
So far, everything is working well. We are now ready to start
development on a new module of my code.
The shop is a repair shop, and I've already done the code for client
management and employee management and all the framewo
24 matches
Mail list logo