On Wed, 07 Apr 2010 21:57:31 -0700, Patrick Maupin wrote:
> On Apr 7, 9:51 pm, Steven D'Aprano
> wrote:
>
> BTW, I don't know how you got 'True' here.
>
>> >>> re.split(' {2,}', s) == [x for x in s.split(' ') if x.strip()]
>> True
It was a copy and paste from the interactive interpreter. Her
On Wed, 07 Apr 2010 20:14:23 -0700, Raymond Hettinger wrote:
> [Raymond Hettinger]
>> > If the two collections have unequal sizes, then both ways immediately
>> > return unequal.
>
> [Steven D'Aprano]
>> Perhaps I'm misinterpreting what you are saying, but I can't confirm
>> that behaviour, at le
On 8 avr, 07:03, Jimbo wrote:
> Hi I have a simple Python program that assigns a cookie to a web user
> when they open the script the 1st time(in an internet browser). If
> they open the script a second time the script should display the line
> " You have been here 2 times." , if they open the scr
Lie Ryan a écrit :
On 04/07/10 18:34, Bruno Desthuilliers wrote:
Lie Ryan a écrit :
(snip)
Since in function in python is a first-class object, you can instead do
something like:
def process(document):
# note: document should encapsulate its own logic
document.do_one_thing()
Obvious
PythoidC (http://pythoidc.sourceforge.net/) provides an easy way for developing
and importing C modules into Python environment. There are some examples, may
be of some help to you.
With PythoidC, Python programmers can write, debug, commpile, C codes all in
Python IDE, and do not have to tacke
Thank you for your help.
Solution with decorators looks well, will try it in near future.
I will report here if I solve this problem.
--
http://mail.python.org/mailman/listinfo/python-list
On Wed, 07 Apr 2010 18:25:36 -0700, Patrick Maupin wrote:
>> Regular expressions != Parsers
>
> True, but lots of parsers *use* regular expressions in their
> tokenizers. In fact, if you have a pure Python parser, you can often
> get huge performance gains by rearranging your code slightly so th
On 06.04.2010 15:58, booncw wrote:
Hi,
I am running a simulation where the python module has already been
imported. Could you please tell me how to load it?
I've been doing this (importing everytime), but it is too slow:
pModule = PyImport_Import(pName);
You can cache the module object in a
On 4/8/2010 3:07 AM, Steven D'Aprano wrote:
On Wed, 07 Apr 2010 20:14:23 -0700, Raymond Hettinger wrote:
[Raymond Hettinger]
If the two collections have unequal sizes, then both ways immediately
return unequal.
[Steven D'Aprano]
Perhaps I'm misinterpreting what you are saying, but I can't c
I am in the process of reading a zipped file which is about 6gb.
I would like to know if there is a command similar to grep in python
because I would like to emulate, -A -B option of GNU grep.
Lets say I have this,
083828.441,AA
093828.441,AA
094028.441,AA
094058.441,CC
094828.441,AA
103828.441,
sapient wrote:
> I found several discussions where this question was asked, but was not
> answered.
>
> Now I am creating Python-API for my application, and want create it
> with translation support, including documentation strings for modules,
> classes, methods etc.
>
> It is simple to transla
Mag Gam, 08.04.2010 13:21:
I am in the process of reading a zipped file which is about 6gb.
I would like to know if there is a command similar to grep in python
because I would like to emulate, -A -B option of GNU grep.
Lets say I have this,
083828.441,AA
093828.441,AA
094028.441,AA
094058.441
At the moment i have less time, so its painful to read about parsing, but it
is quite interessting.
I have taken a look at the different Parsing Modules and i'am reading the
Source Code to understand how they Work. Since Yesterday i'am writing on my
own small Engine - Just for Fun and understa
"Nobody" wrote in message
news:pan.2010.04.08.10.12.59.594...@nowhere.com...
> On Wed, 07 Apr 2010 18:25:36 -0700, Patrick Maupin wrote:
>
>>> Regular expressions != Parsers
>>
>> True, but lots of parsers *use* regular expressions in their
>> tokenizers. In fact, if you have a pure Python pars
i get : IOError: [Errno 9] Bad file descriptor
when i have logging and using daemon.DaemonContext()
i tried passing :
fh = logging.handlers.TimedRotatingFileHandler(LOG_FILENAME, 'midnight',
encoding='utf-8')
with :
context = daemon.DaemonContext()
context.files_preserve=[fh]
but no good
what a
Oh, thats nice to know!
But I use the CSV module with gzip module. Is it still possible to do
it with the subprocess?
On Thu, Apr 8, 2010 at 7:31 AM, Stefan Behnel wrote:
> Mag Gam, 08.04.2010 13:21:
>>
>> I am in the process of reading a zipped file which is about 6gb.
>>
>> I would like to k
when i use this :
context = daemon.DaemonContext(stdin=sys.stdin, stdout=sys.stdout,
files_preserve=[fh], signal_map = {signal.SIGTERM:
'terminate',signal.SIGHUP: 'terminate'})
i don't get error but i still can't write to log file
what am i doing wrong?
--
http://mail.python.org/mailman/listinfo
On Apr 8, 1:28 pm, Rebelo wrote:
> when i use this :
> context = daemon.DaemonContext(stdin=sys.stdin, stdout=sys.stdout,
> files_preserve=[fh], signal_map = {signal.SIGTERM:
> 'terminate',signal.SIGHUP: 'terminate'})
>
> i don't get error but i still can't write to log file
> what am i doing wro
On Apr 8, 1:28 pm, Rebelo wrote:
> when i use this :
> context = daemon.DaemonContext(stdin=sys.stdin, stdout=sys.stdout,
> files_preserve=[fh], signal_map = {signal.SIGTERM:
> 'terminate',signal.SIGHUP: 'terminate'})
>
> i don't get error but i still can't write to log file
> what am i doing wro
Vinay Sajip wrote:
On Apr 8, 1:28 pm, Rebelo wrote:
when i use this :
context = daemon.DaemonContext(stdin=sys.stdin, stdout=sys.stdout,
files_preserve=[fh], signal_map = {signal.SIGTERM:
'terminate',signal.SIGHUP: 'terminate'})
i don't get error but i still can't write to log file
what am i
"Gabriel Genellina" writes:
> En Wed, 07 Apr 2010 18:44:39 -0300, Nikolaus Rath
> escribió:
>
>> def check_s3_refcounts():
>> """Check s3 object reference counts"""
>>
>> global found_errors
>> log.info('Checking S3 object reference counts...')
>>
>> for (key, refcount) in conn.qu
You could user FTP.voidcmd()
E.G.
ftp.voidcmd('RNFT filename.txt')ftp.voidcmd('RNTO newdir/filename.txt')
>From the rfc:
RENAME FROM (RNFR)
This command specifies the old pathname of the file which is
to be renamed. This command must be immediately followed by
a "rename to" command spec
Hallo Everybody,
Maybe you can help me with this:
i have a picture. The picture is black, with some white objects.
Is there any way i can detect the automatically? Something like:
if there white objects bigger than 3 pixels draw a box there or get
their
position!
getting their position is more
On Apr 8, 1:58 pm, Rebelo wrote:
> Vinay Sajip wrote:
> > On Apr 8, 1:28 pm, Rebelo wrote:
> >> when i use this :
> >> context = daemon.DaemonContext(stdin=sys.stdin, stdout=sys.stdout,
> >> files_preserve=[fh], signal_map = {signal.SIGTERM:
> >> 'terminate',signal.SIGHUP: 'terminate'})
>
> >> i
i found a crude workaround:
i wrote a function in which i start logging after deamon starts
--
http://mail.python.org/mailman/listinfo/python-list
Simon wrote:
You could user FTP.voidcmd()
E.G.
ftp.voidcmd('RNFT filename.txt')ftp.voidcmd('RNTO newdir/filename.txt')
From the rfc:
RENAME FROM (RNFR)
This command specifies the old pathname of the file which is
to be renamed. This command must be immediately followed by
a "rename
Vinay Sajip wrote:
On Apr 8, 1:58 pm, Rebelo wrote:
Vinay Sajip wrote:
On Apr 8, 1:28 pm, Rebelo wrote:
when i use this :
context = daemon.DaemonContext(stdin=sys.stdin, stdout=sys.stdout,
files_preserve=[fh], signal_map = {signal.SIGTERM:
'terminate',signal.SIGHUP: 'terminate'})
i don't ge
On Thu, Apr 8, 2010 at 01:16, Kushal Kumaran
wrote:
>
> Is there any particular reason you absolutely must extract the status
> message? If you already have a list of possible status messages, you
> could just test which one of those is present in the line...
Yes and no...
Mostly, it's for the
On Apr 8, 9:17 am, Jannis Syntychakis wrote:
> Hallo Everybody,
>
> Maybe you can help me with this:
>
> i have a picture. The picture is black, with some white objects.
>
> Is there any way i can detect the automatically? Something like:
> if there white objects bigger than 3 pixels draw a box th
Hi,
I'd like to call an external application (firefox) from a python program (a
PyQT GUI), but I want the external application to run in the background, I
mean I do not want my python calling program to wait till the external
subprocess terminates.
I've tried this:
call(["firefox", "http://www.py
Lie Ryan wrote:
Why am I seeing a lot of this pattern lately:
OP: Got problem with string
+- A: Suggested a regex-based solution
+- B: Quoted "Some people ... regex ... two problems."
or
OP: Writes some regex, found problem
+- A: Quoted "Some people ... regex ... two problems."
+- B: Sup
On Thu, Apr 8, 2010 at 7:39 PM, jorma kala wrote:
> Hi,
>
> I'd like to call an external application (firefox) from a python program (a
> PyQT GUI), but I want the external application to run in the background, I
> mean I do not want my python calling program to wait till the external
> subprocess
On 2010-04-08, Steven D'Aprano wrote:
> Even in 2010, there are plenty of programs that export data using fixed
> width fields.
If you want the columns to line up as the data changes, that's pretty
much the only way to go.
--
Grant Edwards grant.b.edwardsYow! But was he
Attempting to read a file containing Unicode characters such as ±:
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position
5007: ordinal not in range(128)
I did succeed by converting all the characters to HTML entities such
as "±", but I want the characters to be the actual font in th
lookup "connected component labeling" in a machine vision book.
On Thu, Apr 8, 2010 at 9:57 AM, Chris Hulan wrote:
> On Apr 8, 9:17 am, Jannis Syntychakis wrote:
>> Hallo Everybody,
>>
>> Maybe you can help me with this:
>>
>> i have a picture. The picture is black, with some white objects.
>>
>
Gnarlodious wrote:
> Attempting to read a file containing Unicode characters such as ±:
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position
> 5007: ordinal not in range(128)
>
> I did succeed by converting all the characters to HTML entities such
> as "±", but I want the charact
[Steven D'Aprano]
> So what happens in my example with a subclass that (falsely) reports a
> different length even when the lists are the same?
>
> I can guess that perhaps Py_SIZE does not call the subclass __len__
> method, and therefore is not fooled by it lying. Is that the case?
Yes. Py_SIZE
All,
I am trying to replace a series of periods in a sting with backspaces
that way I can easily parse information from a Windows command. the
current statement I have for this is
***Statement
capture = re.sub('\.*', '\b', capture)
===
I am trying to do this
if os.path.exists("*.*.txt"):
file=open("*.*.txt")
self.text_view.get_buffer().set_text(file.read())
else:
file=open("*.*.html")
self.text_view.get_buffer().set_text(file.read())
It gives error *.*.txt not existingThere are
Mag Gam, 08.04.2010 14:21:
On Thu, Apr 8, 2010 at 7:31 AM, Stefan Behnel wrote:
Mag Gam, 08.04.2010 13:21:
I am in the process of reading a zipped file which is about 6gb.
I would like to know if there is a command similar to grep in python
because I would like to emulate, -A -B option of GNU
On Thu, Apr 8, 2010 at 9:00 PM, varnikat t wrote:
> I am trying to do this
> if os.path.exists("*.*.txt"):
> file=open("*.*.txt")
> self.text_view.get_buffer().set_text(file.read())
> else:
> file=open("*.*.html")
> self.text_view.get_buffer().set_te
On Apr 8, 9:14 am, "Martin v. Loewis" wrote:
> When opening the file, you need to specify the file encoding.
OK, I had tried this:
open(path, 'r').read().encode('utf-8')
however I get error
TypeError: Can't convert 'bytes' object to str implicitly
I had assumed a Unicode string was a Unicode
Max Kotasek writes:
> Hello to all out there,
>
> I'm trying to figure out how to parse the responses from fcntl.ioctl()
> calls that modify the serial lines in a way that asserts that the line
> is now changed. For example I may want to drop RTS explicitly, and
> assert that the line has been d
On Thu, Apr 8, 2010 at 11:42 AM, Kushal Kumaran
wrote:
> On Thu, Apr 8, 2010 at 9:00 PM, varnikat t wrote:
>> I am trying to do this
>> if os.path.exists("*.*.txt"):
>> file=open("*.*.txt")
>> self.text_view.get_buffer().set_text(file.read())
>> else:
>> file=o
Hi all,
i'ld like to create an gnome applet in python that, if left-clicked,
perform a particular operation using the text of the clipboard.
i've found this example:
import pygtk
pygtk.require('2.0')
import gtk
# get the clipboard
clipboard = gtk.clipboard_get()
# read the clipboard text data.
John Nagle writes:
> In theory, the FTP spec supports "three-way transfers", where the
> source, destination, and control can all be on different machines.
> But no modern implementation supports that.
I remember even using that way back when, Unix machines in the 1990s.
But, server to ser
On 2010-04-07, Max Kotasek wrote:
> I'm trying to figure out how to parse the responses from fcntl.ioctl()
> calls that modify the serial lines in a way that asserts that the line
> is now changed.
Two comments:
1) None of the Linux serial drivers I've worked on return line states
except
On 2010-04-08, Anssi Saari wrote:
> It seems to me also that RTS is always on after the port has been
> opened. I didn't dig out my voltmeter or anything to check this,
> though.
IIRC, that's generally true: RTS and DTR are both set to "on" by the
tty layer's open() handler _if_ the device's use
On 04/08/2010 08:57 AM, Chris Colbert wrote:
On Thu, Apr 8, 2010 at 11:42 AM, Kushal Kumaran
wrote:
On Thu, Apr 8, 2010 at 9:00 PM, varnikat t wrote:
I am trying to do this
if os.path.exists("*.*.txt"):
file=open("*.*.txt")
self.text_view.get_buffer().set_
I'm having a difficult time with this. I want
to display a continuous range of hues using HTML
hex representation (#RRGGBB). How would I go
about scanning through the hues in order to
make a rainbow?
Thanks,
Toby
--
http://mail.python.org/mailman/listinfo/python-list
Gnarlodious wrote:
> On Apr 8, 9:14 am, "Martin v. Loewis" wrote:
>
>> When opening the file, you need to specify the file encoding.
>
> OK, I had tried this:
>
> open(path, 'r').read().encode('utf-8')
No, when *opening* the file, you need to specify the encoding:
open(path, 'r', encoding='utf
On Thu, Apr 8, 2010 at 12:46 PM, Tobiah wrote:
> I'm having a difficult time with this. I want
> to display a continuous range of hues using HTML
> hex representation (#RRGGBB). How would I go
> about scanning through the hues in order to
> make a rainbow?
>
> Thanks,
>
> Toby
> --
> http://mail
On Apr 8, 5:46 pm, Tobiah wrote:
> I'm having a difficult time with this. I want
> to display a continuous range of hues using HTML
> hex representation (#RRGGBB). How would I go
> about scanning through the hues in order to
> make a rainbow?
>
> Thanks,
>
> Toby
Look at the colorsys module.
h
> Look at the colorsys module.
>
> http://docs.python.org/library/colorsys.html?highlight=colorsys#module-
colorsys
That so rocks. Thanks!
--
http://mail.python.org/mailman/listinfo/python-list
Hey,
Thanks for the help.it detects now using glob.glob("*.*.txt")
Can u suggest how to open and read file this way?
*if glob.glob("*.*.txt"):
file=open(glob.glob("*.*.txt"))
self.text_view.get_buffer().set_text(file.read())
else:
file=open(glob.glob("*
it gives me this error
TypeError: coercing to Unicode: need string or buffer, list found
On Thu, Apr 8, 2010 at 10:48 PM, varnikat t wrote:
>
>
>
>
> Hey,
> Thanks for the help.it detects now using glob.glob("*.*.txt")
> Can u suggest how to open and read file this way?
>
> *if glob.glob("*.*.
Tobiah wrote:
I'm having a difficult time with this. I want
to display a continuous range of hues using HTML
hex representation (#RRGGBB). How would I go
about scanning through the hues in order to
make a rainbow?
Thanks,
Toby
Use the hue-saturation-value color space, and call hsv_to_r
On Thu, Apr 8, 2010 at 1:14 PM, Tobiah wrote:
>> Look at the colorsys module.
>>
>> http://docs.python.org/library/colorsys.html?highlight=colorsys#module-
> colorsys
>
> That so rocks. Thanks!
> --
> http://mail.python.org/mailman/listinfo/python-list
>
How does that answer your original questi
On Apr 8, 11:04 am, "Martin v. Loewis" wrote:
> That's because you need to re-learn some things.
Apparently so, every little item is a lesson. Thank you.
-- Gnarlie
--
http://mail.python.org/mailman/listinfo/python-list
En Thu, 08 Apr 2010 12:26:56 -0300, Booter escribió:
I am trying to replace a series of periods in a sting with backspaces
that way I can easily parse information from a Windows command. the
current statement I have for this is
***Statement*
I'm trying the following statements that I found here and there on
Google, but none of them works on my Python 2.5, are they too old? or
newer?
"abc".reverse()
import numpy
--
http://mail.python.org/mailman/listinfo/python-list
On Apr 8, 4:20 am, Bruno Desthuilliers wrote:
> Lie Ryan a écrit :
>
>
>
>
>
> > On 04/07/10 18:34, Bruno Desthuilliers wrote:
> >> Lie Ryan a écrit :
> >> (snip)
>
> >>> Since in function in python is a first-class object, you can instead do
> >>> something like:
>
> >>> def process(document):
>
On Thu, Apr 8, 2010 at 10:39 PM, varnikat t wrote:
> Hey,
> Thanks for the help.it detects now using glob.glob("*.*.txt")
> Can u suggest how to open and read file this way?
>
> if glob.glob("*.*.txt"):
> file=open(glob.glob("*.*.txt"))
> self.text_view.get_buffer().set_tex
M. Hamed wrote:
> I'm trying the following statements that I found here and there on
> Google, but none of them works on my Python 2.5, are they too old? or
> newer?
>
> "abc".reverse()
> import numpy
reverse does not work on strings but does work on lists:
>>> x=list("abc")
>>> x.reverse()
>>>
On Apr 8, 7:10 pm, "M. Hamed"
wrote:
> I'm trying the following statements that I found here and there on
> Google, but none of them works on my Python 2.5, are they too old? or
> newer?
>
> "abc".reverse()
This isn't valid Python in any version that I'm aware of. Where did
you see it? It would
> How does that answer your original question?
I was able to do this:
import colorsys
sat = 1
value = 1
length = 1000
for x in range(0, length + 1):
hue = x / float(length)
color = list(colorsys.hsv_to_rgb(hue, sat, value))
for x in range(3):
color[x] = in
M. Hamed wrote:
I'm trying the following statements that I found here and there on
Google, but none of them works on my Python 2.5, are they too old? or
newer?
"abc".reverse()
Lists have a .reverse() method which reverses the list elements
in-place, but strings don't because they're immutable.
Anssi Saari wrote:
John Nagle writes:
In theory, the FTP spec supports "three-way transfers", where the
source, destination, and control can all be on different machines.
But no modern implementation supports that.
I remember even using that way back when, Unix machines in the 1990s.
[ python3.1.1, re.__version__='2.2.1' ]
I'm trying to use re to split a string into (any number of) pieces of
these kinds:
1) contiguous runs of letters
2) contiguous runs of digits
3) single other characters
e.g. 555tHe-rain.in#=1234 should give: [555, 'tHe', '-', 'rain',
'.', 'in', '#', '=
gry wrote:
[ python3.1.1, re.__version__='2.2.1' ]
I'm trying to use re to split a string into (any number of) pieces of
these kinds:
1) contiguous runs of letters
2) contiguous runs of digits
3) single other characters
e.g. 555tHe-rain.in#=1234 should give: [555, 'tHe', '-', 'rain',
'.',
On 8 Apr, 19:49, gry wrote:
> [ python3.1.1, re.__version__='2.2.1' ]
> I'm trying to use re to split a string into (any number of) pieces of
> these kinds:
> 1) contiguous runs of letters
> 2) contiguous runs of digits
> 3) single other characters
>
> e.g. 555tHe-rain.in#=1234 should give:
On Apr 8, 1:49 pm, gry wrote:
> [ python3.1.1, re.__version__='2.2.1' ]
> I'm trying to use re to split a string into (any number of) pieces of
> these kinds:
> 1) contiguous runs of letters
> 2) contiguous runs of digits
> 3) single other characters
>
> e.g. 555tHe-rain.in#=1234 should give:
gry wrote:
[ python3.1.1, re.__version__='2.2.1' ]
I'm trying to use re to split a string into (any number of) pieces of
these kinds:
1) contiguous runs of letters
2) contiguous runs of digits
3) single other characters
e.g. 555tHe-rain.in#=1234 should give: [555, 'tHe', '-', 'rain',
'.',
Thanks All. That clears alot of confusion. It seems I assumed that
everything that works for lists works for strings (the immutable vs
mutable hasn't sunken in yet).
On the other hand (other than installing NumPy) is there a built-in
way to do an array full of zeros or one just like the numpy.zero
I have trouble with some Python concept. The fact that you can not
assign to a non-existent index in an array. For example:
a = [0,1]
a[2] => Generates an error
I can use a.append(2) but that always appends to the end. Sometimes I
want to use this array as a stack and hence my indexing lo
On 4/8/2010 1:08 PM M. Hamed said...
On the other hand (other than installing NumPy) is there a built-in
way to do an array full of zeros or one just like the numpy.zeros()? I
know I can do it with list comprehension (like [0 for i in
range(0,20)] but these are too many keystrokes for python :) I
On Apr 8, 3:21 pm, "M. Hamed" wrote:
> I have trouble with some Python concept. The fact that you can not
> assign to a non-existent index in an array. For example:
>
> a = [0,1]
> a[2] => Generates an error
>
> I can use a.append(2) but that always appends to the end. Sometimes I
> want t
On Apr 8, 3:21 pm, "M. Hamed" wrote:
> I have trouble with some Python concept. The fact that you can not
> assign to a non-existent index in an array. For example:
>
> a = [0,1]
> a[2] => Generates an error
>
> I can use a.append(2) but that always appends to the end. Sometimes I
> want t
Grant Edwards writes:
> If it's 2D data, you don't need to use a 3D graph.
if it's tabular data, you don't need an uber-histogram
--
giampippetto, coso, come si chiama? ah si` "MMAX" ha scritto:
> Tra il trascendente e l'interpretazione prevalente del dato come
> assioma ne passa...
--
http://
On 2010-04-08 15:08 PM, M. Hamed wrote:
On the other hand (other than installing NumPy) is there a built-in
way to do an array full of zeros or one just like the numpy.zeros()? I
know I can do it with list comprehension (like [0 for i in
range(0,20)] but these are too many keystrokes for python
On Apr 8, 3:40 pm, MRAB wrote:
...
> Group 1 and group 4 match '='.
> Group 1 and group 3 match '1234'.
>
> If a group matches then any earlier match of that group is discarded,
Wow, that makes this much clearer! I wonder if this behaviour
shouldn't be mentioned in some form in the python docs?
On 8 Apr, 19:49, gry wrote:
> [ python3.1.1, re.__version__='2.2.1' ]
> I'm trying to use re to split a string into (any number of) pieces of
> these kinds:
> 1) contiguous runs of letters
> 2) contiguous runs of digits
> 3) single other characters
>
> e.g. 555tHe-rain.in#=1234 should give:
On Apr 8, 10:08 pm, "M. Hamed"
wrote:
> Thanks All. That clears alot of confusion. It seems I assumed that
> everything that works for lists works for strings (the immutable vs
> mutable hasn't sunken in yet).
>
> On the other hand (other than installing NumPy) is there a built-in
> way to do an a
Manuel Graune writes:
> Hello everyone,
>
> I am looking for ways to use a python file as a substitute for simple
> pen and paper calculations.
search("embedded calc mode") if manuel in emacs_fellows_set or sys.exit(1)
--
http://mail.python.org/mailman/listinfo/python-list
Tobiah wrote:
How does that answer your original question?
I was able to do this:
import colorsys
sat = 1
value = 1
length = 1000
for x in range(0, length + 1):
hue = x / float(length)
color = list(colorsys.hsv_to_rgb(hue, sat, value))
for x in range(3):
> >>> s='555tHe-rain.in#=1234'
> >>> import re
> >>> r=re.compile(r'([a-zA-Z]+|\d+|.)')
> >>> r.findall(s)
> ['555', 'tHe', '-', 'rain', '.', 'in', '#', '=', '1234']
This is nice and simple and has the invertible property that Patrick
mentioned above. Thanks much!
--
http://mail.py
Giacomo Boffi writes:
> Manuel Graune writes:
>
>> Hello everyone,
>>
>> I am looking for ways to use a python file as a substitute for simple
>> pen and paper calculations.
>
> search("embedded calc mode") if manuel in emacs_fellows_set or sys.exit(1)
Well, the subject does say python and not
Thanks Patrick, that is what I was exactly looking for.
Paul, thanks for your example. wasn't familiar with the stack class. I
feel Patrick's method is a lot simpler for my purpose.
Regards.
On Apr 8, 1:29 pm, Patrick Maupin wrote:
> On Apr 8, 3:21 pm, "M. Hamed" wrote:
>
>
>
> > I have troubl
OMG! That's beautiful! I loved the [0]*n how simple and how it never
occurred to me!
Robert I agree with your comment. I feel though that since I'm not
very experienced yet with Python, it's useful to learn about all those
simple yet powerful methods so I can use them when I really need them.
Plus
On Apr 8, 3:40 pm, gry wrote:
> > >>> s='555tHe-rain.in#=1234'
> > >>> import re
> > >>> r=re.compile(r'([a-zA-Z]+|\d+|.)')
> > >>> r.findall(s)
> > ['555', 'tHe', '-', 'rain', '.', 'in', '#', '=', '1234']
>
> This is nice and simple and has the invertible property that Patrick
> me
On 4/9/10, Tim Chase wrote:
> Lie Ryan wrote:
>> Why am I seeing a lot of this pattern lately:
>>
>> OP: Got problem with string
>> +- A: Suggested a regex-based solution
>>+- B: Quoted "Some people ... regex ... two problems."
>>
>> or
>>
>> OP: Writes some regex, found problem
>> +- A: Quote
Tobiah:
> for x in range(0, length + 1):
> ...
> for x in range(3):
You should use different variables for the two loops.
Neil
--
http://mail.python.org/mailman/listinfo/python-list
Me:
>You should use different variables for the two loops.
Actually it is closing the divs that makes it work in FireFox:
import colorsys
sat = 1
value = 1
length = 1000
for h in range(0, length + 1):
hue = h / float(length)
color = list(colorsys.hsv_to_rgb(hue, sat, value
On Thu, Apr 8, 2010 at 2:34 PM, Tobiah wrote:
>> How does that answer your original question?
>
> I was able to do this:
>
> import colorsys
>
> sat = 1
> value = 1
> length = 1000
> for x in range(0, length + 1):
> hue = x / float(length)
> color = list(colorsys.hsv_to_rgb(hue, sat,
I have a list...
['dir_0_error.dat', 'dir_120_error.dat', 'dir_30_error.dat',
'dir_330_error.dat']
I want to sort it based upon the numerical value only.
Does someone have an elegant solution to this?
Thanks,
Ben R.
--
http://mail.python.org/mailman/listinfo/python-list
On Thu, Apr 8, 2010 at 3:52 PM, Ben Racine wrote:
> I have a list...
>
> ['dir_0_error.dat', 'dir_120_error.dat', 'dir_30_error.dat',
> 'dir_330_error.dat']
>
> I want to sort it based upon the numerical value only.
a = ['dir_0_error.dat', 'dir_120_error.dat', 'dir_30_error.dat',
'dir_330_error.
Ben Racine wrote:
I have a list...
['dir_0_error.dat', 'dir_120_error.dat', 'dir_30_error.dat',
'dir_330_error.dat']
I want to sort it based upon the numerical value only.
Does someone have an elegant solution to this?
Thanks,
Ben R.
How about a one liner?
L.sort(key=lambda s: int
On Apr 9, 12:52 am, Ben Racine wrote:
> I have a list...
>
> ['dir_0_error.dat', 'dir_120_error.dat', 'dir_30_error.dat',
> 'dir_330_error.dat']
>
> I want to sort it based upon the numerical value only.
>
> Does someone have an elegant solution to this?
>
> Thanks,
> Ben R.
not sure about elega
On 4/7/2010 1:08 PM, Peter Pearson wrote:
On Tue, 06 Apr 2010 23:16:18 -0400, monkeys paw wrote:
I have the following acre meter which works for integers,
how do i convert this to float? I tried
return float ((208.0 * 208.0) * n)
def s(n):
... return lambda x: (208 * 208) * n
...
f = s
On Apr 8, 6:06 pm, monkeys paw wrote:
> On 4/7/2010 1:08 PM, Peter Pearson wrote:
>
>
>
> > On Tue, 06 Apr 2010 23:16:18 -0400, monkeys paw wrote:
> >> I have the following acre meter which works for integers,
> >> how do i convert this to float? I tried
>
> >> return float ((208.0 * 208.0) * n)
1 - 100 of 131 matches
Mail list logo