On Feb 5, 6:18 pm, [EMAIL PROTECTED] wrote:
Firstly, thanks to those who posted.
I just do not understand how the non-greedy operator works.
Using the following code:
import re
s = qry_Lookup.desc = CSS_Rpt1.desc AND qry_Lookup.lcdu1 =
CSS_Rpt1.lcdu
pat = (.+=)+?(.+)
^^
On Feb 20, 7:36 pm, Amit Gupta [EMAIL PROTECTED] wrote:
Before I read the message: I screwed up.
Let me write again
x = re.compile(CL(?Pname1[a-z]+))
# group name name1 is attached to the match of lowercase string of
alphabet
# Now I have a dictionary saying {name1, iamgood}
# I would
On Mar 13, 4:25 am, David S [EMAIL PROTECTED] wrote:
Hi,
I have an error occurring at
self.build_root = os.path.abspath(os.path.split(__file__)[0])
The error states 'NameError: global name '__file__' is not defined'
In Python 2.5 I ran my script as a module in IDLE gui. How does
On Mar 16, 2:27 am, Benjamin [EMAIL PROTECTED] wrote:
On Mar 15, 8:12 pm, lampshade [EMAIL PROTECTED] wrote: Hello,
I'm having some problems with os.path.isdir I think it is something
simple that I'm overlooking.
#!/usr/bin/python
import os
my_path = os.path.expanduser(~/pictures/)
On Mar 21, 3:05 am, Jeremy N [EMAIL PROTECTED] wrote:
I am working with Python in Maya, and have run into a problem with a
variable changing its contents without being scripted to do so. The
various print() statements below were from my efforts to track down
where it was occurring. I left them
On Mar 21, 11:48 am, fkallgren [EMAIL PROTECTED] wrote:
Hi.
I have a little problem. I have a script that is in the scheduler
(win32). But every now and then I update this script and I dont want
to go to every computer and update it. So now I want the program to 1)
check for new version of
On Mar 30, 6:35 am, Gabriel Genellina [EMAIL PROTECTED]
wrote:
En Sun, 30 Mar 2008 02:11:33 -0300, hdante [EMAIL PROTECTED] escribió:
BTW, my opinion is that it's already time that programmer editors
have input methods advanced enough for generating this:
if x ≠ 0:
∀y ∈ s:
On Mar 30, 7:59 pm, Gabriel Genellina [EMAIL PROTECTED]
wrote:
En Sun, 30 Mar 2008 11:10:20 -0300, MRAB [EMAIL PROTECTED]
escribió:
On Mar 30, 6:35 am, Gabriel Genellina [EMAIL PROTECTED]
wrote:
En Sun, 30 Mar 2008 02:11:33 -0300, hdante [EMAIL PROTECTED] escribió:
BTW, my opinion
On Apr 2, 5:01 pm, Maurizio Vitale [EMAIL PROTECTED]
wrote:
Has to be something really stupid, but the following never finish
(running Python 2.5.1 (r251:54863, Jan 10 2008, 18:00:49)
[GCC 4.2.1 (SUSE Linux)] on linux2).
The intention is to match C++ identifiers, with or without namespace
On Apr 17, 5:22 am, Torsten Bronger [EMAIL PROTECTED]
wrote:
Hallöchen!
Tim Daneliuk writes:
Daniel Fetchinson wrote:
[...]
I just had one moment of exceptional clarity, during which
realized how I could get the GIL out of my way... It's so
simple, I cannot help wondering why nobody
On Apr 17, 9:39 am, Robert Bossy [EMAIL PROTECTED] wrote:
Gabriel Genellina wrote:
En Wed, 16 Apr 2008 17:53:16 -0300, [EMAIL PROTECTED] escribió:
On Apr 16, 3:27 pm, Jean-Paul Calderone [EMAIL PROTECTED] wrote:
Any function can be implemented without recursion, although it isn't
always
On Apr 21, 11:48 pm, [EMAIL PROTECTED] [EMAIL PROTECTED]
wrote:
Hi...
Here's a weird problem...I'm trying to escape a bunch of data to put
into a database.
Here's what I have:
def escape(string):
Escape both single quotes and blackslashes
x = rfun\fun
escape(x)
On Apr 30, 10:47 am, [EMAIL PROTECTED] wrote:
A rather off-topic and perhaps naive question, but isn't a 1:4
production/test ratio a bit too much ? Is there a guesstimate of what
percentage of this test code tests for things that you would get for
free in a statically typed language ? I'm
On May 8, 4:34 am, Yves Dorfsman [EMAIL PROTECTED] wrote:
Miles wrote:
On Wed, May 7, 2008 at 7:46 PM, Ivan Illarionov
Is there a way to do:
x = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
x[0,2:6]
That would return:
[0, 3, 4, 5, 6]
Arg... Yes, this is a typo, I meant:
[1,
On May 9, 3:04 am, Eric Wertman [EMAIL PROTECTED] wrote:
Something like this. I'm sure there are other ways to do it.
import re
def addspace(m) :
return ' ' + m.group(0)
strng = ModeCommand
newstr = re.sub('[A-Z]',addspace,strng)
Alternatively:
newstr = re.sub('([A-Z])',r'
On May 12, 8:31 am, Duncan Booth [EMAIL PROTECTED] wrote:
Dennis Lee Bieber [EMAIL PROTECTED] wrote:
The sloppy use of single quote for the apostrophe is unfortunate
G
True, but that problem is outside of the Python community's control. Given
that people do often refer to single quote
On May 13, 6:32 pm, D'Arcy J.M. Cain [EMAIL PROTECTED] wrote:
On Tue, 13 May 2008 19:57:10 +0300
Andrii V. Mishkovskyi [EMAIL PROTECTED] wrote:
Not everybody has grown in English-speaking community, you know. And
knowing math quite good, I prefer writing x = y instead of Set x to
y.
On May 14, 10:30 pm, [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote:
Dave Parker schrieb:
All of the calculators and textbooks that elementary school students
use, use ^ for powers.
I've never seen this symbol in textbooks. In textbooks, powers are
written using superscript.
Just like
On May 15, 9:00 pm, max [EMAIL PROTECTED] wrote:
you're right, my java implementation does indeed parse for Id3v2
(sorry for the confusion). i'm using the getrawid3v2() method of this
bitstream class (http://www.javazoom.net/javalayer/docs/docs0.4/
javazoom/jl/decoder/Bitstream.html) to
On May 16, 10:22 pm, Dan Upton [EMAIL PROTECTED] wrote:
This might be more information than necessary, but it's the best way I
can think of to describe the question without being too vague.
The task:
I have a list of processes (well, strings to execute said processes)
and I want to,
bvdp wrote:
When reading lines of data from a file in the from (no quotes!)
foo\x20bar
and I assign to a variable in a line line like:
f = file('infile', 'r')
for a in f:
print a
the string is read in as string with the literal characters 'f', 'o' ...
'x' , '2' ...
as compared
bvdp wrote:
MRAB wrote:
bvdp wrote:
When reading lines of data from a file in the from (no quotes!)
foo\x20bar
and I assign to a variable in a line line like:
f = file('infile', 'r')
for a in f:
print a
the string is read in as string with the literal characters 'f', 'o'
... 'x
bvdp wrote:
So, we think something is working and send of a bug fix to our client :)
I'm not sure I understand this at all and wonder if there is bug?
a=c:\\Program\x20Files\\test
a
'c:\\Program Files\\test'
so far, so good.
a.decode(string-escape)
'c:\\Program Files\test'
Umm, not
Vincent Davis wrote:
I am trying to read a csv file from excel on a mac. I get the following
error.
SystemExit: file some.csv, line 1: new-line character seen in unquoted
field - do you need to open the file in universal-newline mode?
I was using the example code
import csv, sys
reader =
Benjamin Kaplan wrote:
On Mon, Feb 23, 2009 at 6:43 PM, MRAB goo...@mrabarnett.plus.com
mailto:goo...@mrabarnett.plus.com wrote:
Vincent Davis wrote:
I am trying to read a csv file from excel on a mac. I get the
following error.
SystemExit: file some.csv, line 1
harijay wrote:
In my last post I had asked about reading data from a binary file
using the struct module.
Thanks to some excellent help , I have managed to read in
successfully
most of the header of this binary format that I want to parse. These
are some time-voltage traces from a digital
to
jkv wrote:
Hi,
Are there any way to change the EOL character for sys.stdin.readline()
and raw_input()?
My problem is that i cannot rely on that the clients connection to my
application will end all lines with \n or \r\n. Sometimes they will use
\r\000 as EOL.
Example from my code:
Trip Technician wrote:
anyone interested in looking at the following problem.
we are trying to express numbers as minimal expressions using only the
digits one two and three, with conventional arithmetic. so for
instance
33 = 2^(3+2)+1 = 3^3+(3*2)
are both minimal, using 4 digits but
33 =
Gabriel Genellina wrote:
En Fri, 27 Feb 2009 09:29:16 -0200, Ulrich Eckhardt
eckha...@satorlaser.com escribió:
I have a socket from which I would like to parse some data, how would
I do
that? Of course, I can manually read data from the socket until unpack()
stops complaining about a lack of
Muddy Coder wrote:
Hi Folks,
As directed, I got ClientForm and played with it. It is cool! However,
I also found a bug:
When it parses a form, if the VALUE of a field has not space, it works
very well. For example, if a dropdown list, there many options, such
as:
option value=foo
the
J wrote:
Is it possible to make a GUI email program in Python that stores
emails, composes, ect?
Yes.
--
http://mail.python.org/mailman/listinfo/python-list
bruce wrote:
Hi.
Got a bit of a question/issue that I'm trying to resolve. I'm asking this of
a few groups so bear with me.
I'm considering a situation where I have multiple processes running, and
each process is going to access a number of files in a dir. Each process
accesses a unique group
Steven D'Aprano wrote:
On Mon, 02 Mar 2009 01:00:54 -0500, David Lyon wrote:
It might seem a simple question.. but how does one programmaticaly unzip
a file in python?
A quick and dirty solution would be something like this:
zf = zipfile.ZipFile('Archive.zip')
for name in zf.namelist():
Luis Zarrabeitia wrote:
Quoting MRAB goo...@mrabarnett.plus.com:
Steven D'Aprano wrote:
A quick and dirty solution would be something like this:
zf = zipfile.ZipFile('Archive.zip')
for name in zf.namelist():
open(name, 'w').write(zf.read(name))
You might want to specify an output folder
Gabriel Genellina wrote:
En Mon, 02 Mar 2009 17:58:01 -0200, Bo Zhang primroseb...@gmail.com
escribió:
I want to parse a file and do this :
A 74.335 -86.474-129.317 1.00 54.12
then add space between -86.474 and -129.317. I can get the file with
A 74.335 -86.474 -129.317 1.00
Rey Bango wrote:
Hi,
I'd like to upgrade the installed version of Python that came standard
on OS X (Leopard) with either 2.6.1 or 3.0.1. Before I stick my foot
in it, I just wanted to get a better understanding of the process.
If I download the disk image installer from here:
Fab86 wrote:
I am getting res1 and res2 etc from this code:
srch1 = WebSearch(app_id=YahooKey)
srch1.query = avoir site:.al
res1 = srch1.parse_results()
srch2 = WebSearch(app_id=YahooKey)
srch2.query = avoir site:.fr
res2 = srch2.parse_results()
After identifying res1, I then use the
Chris Rebert wrote:
On Tue, Mar 3, 2009 at 9:05 AM, Ivan i...@invalid.net wrote:
Hello everyone,
I know this is not a direct python question, forgive me for that, but
maybe some of you will still be able to help me. I've been told that
for my application it would be best to learn a scripting
Fab86 wrote:
On Mar 3, 8:59 pm, Gabriel Genellina gagsl-...@yahoo.com.ar wrote:
En Tue, 03 Mar 2009 16:50:25 -0200, Fab86 fabien.h...@gmail.com escribió:
On Mar 3, 6:48 pm, Gabriel Genellina gagsl-...@yahoo.com.ar wrote:
En Tue, 03 Mar 2009 16:39:43 -0200, Fab86 fabien.h...@gmail.com
Fab86 wrote:
On Mar 4, 1:40 am, Gabriel Genellina gagsl-...@yahoo.com.ar wrote:
En Tue, 03 Mar 2009 23:11:30 -0200, Fab86 fabien.h...@gmail.com escribió:
On Mar 4, 12:00 am, MRAB goo...@mrabarnett.plus.com wrote:
Fab86 wrote:
On Mar 3, 8:59 pm, Gabriel Genellina gagsl-...@yahoo.com.ar
bruce wrote:
Hi...
Sorry that this is a bit off track. Ok, maybe way off track!
But I don't have anyone to bounce this off of..
I'm working on a crawling project, crawling a college website, to extract
course/class information. I've built a quick test app in python to crawl the
site. I crawl
Aahz wrote:
In article mailman.9538.1234633556.3487.python-l...@python.org,
Terry Reedy tjre...@udel.edu wrote:
for line in open('char.txt'):
if line.find('sweet') != -1 or line.find('blue') != -1:
print(line)
For any recent Python, this should be:
if 'sweet' in line or 'blue' in
Fab86 wrote:
On Mar 4, 2:49 pm, MRAB goo...@mrabarnett.plus.com wrote:
Fab86 wrote:
On Mar 4, 1:40 am, Gabriel Genellina gagsl-...@yahoo.com.ar wrote:
En Tue, 03 Mar 2009 23:11:30 -0200, Fab86 fabien.h...@gmail.com escribió:
On Mar 4, 12:00 am, MRAB goo...@mrabarnett.plus.com wrote:
Fab86
Paul Rubin wrote:
Tim Wintle tim.win...@teamrubber.com writes:
Surely you can address an infinite amount of storage using infinite
length integers and a wrapper to files on disk - then it's just your
OS's limits that hold it back - so python is turing/register complete.
Python doesn't have
Limin Fu wrote:
Dennis Lee Bieber wrote:
Whatever it is, the name does tend to lend confusion with the older
Microsoft database access method DAO (which was superceded by ADO).
I don't think there is confusion here, because the Microsoft database
access method DAO is not a programming
John Nagle wrote:
Minesh Patel wrote:
On Fri, Mar 6, 2009 at 3:16 PM, Jean-Paul Calderone
exar...@divmod.com wrote:
On Fri, 6 Mar 2009 14:50:51 -0800, Minesh Patel min...@gmail.com
wrote:
I am trying to figure out the best approach to solve this problem:
I want to poll various
Lo wrote:
I just tried python first time.
2/3
the result is zero
I want the result to be .333...
How do I get this?
That's integer division (integer divided by integer is integer).
If you want the result to be floating point then make one of them
floating point:
2.0 / 3
or do this
Explore_Imagination wrote:
Hi
I want to map 64 bit integers from C to python. I must use Python 2.2
BUT There is no support for 64 bits integers in Python2.2 (Supported
in 2.5).
Now the problem is that I have these four variables:
unit32_t a,b,c;
uint64_t w,x,y,z;
I use this funtion to map
Rickey, Kyle W wrote:
Hello everyone,
I would like to be able to eject a usb drive based on drive letter. I've
done a bit of googling and came across the CM_Request_Device_Eject
function on MSDN (http://msdn.microsoft.com/en-us/library/ms790831.aspx)
However, I am not quite sure how
Daniel Fetchinson wrote:
Python 2.5.1 (r251:54863, Oct 30 2007, 13:45:26)
[GCC 4.1.2 20070925 (Red Hat 4.1.2-33)] on linux2
Type help, copyright, credits or license for more information.
x = { }
x[lambda arg: arg] = 5
x[lambda arg: arg]
Traceback (most recent call last):
File stdin, line 1,
Oltmans wrote:
I've a multithreaded program in which I've to call class methods from
class methods. Here is how my code look like (excluding imports),. Any
help is highly appreciated.
#!/usr/bin/env python
class Requests(Thread):
def __init__(self, times):
Thread.__init__(self)
Raymond Hettinger wrote:
[snip]
Proposal I (from Nick Coghlan):
---
A comma will be added to the format() specifier mini-language:
[[fill]align][sign][#][0][minimumwidth][,][.precision][type]
The ',' option indicates that commas should be included in the
output as
Jim Garrison wrote:
Tim Chase wrote:
ra\
SyntaxError: EOL while scanning string literal (pyshell#45, line 1)
It seems the parser is interpreting the backslash as an escape
character in a raw string if the backslash is the last character.
Is this expected?
Yep...as documented[1], even a
andrew cooke wrote:
MRAB wrote:
[...]
The other special case is with \u in a Unicode string:
ur\u0041
u'A'
this isn't true for 3.0:
r\u0041
'\\u0041'
(there's no u because it's a string, not a bytes literal)
and as far as i can tell, that's correct behaviour according to the docs
andrew cooke wrote:
MRAB wrote:
andrew cooke wrote:
MRAB wrote:
[...]
The other special case is with \u in a Unicode string:
ur\u0041
u'A'
this isn't true for 3.0:
r\u0041
'\\u0041'
(there's no u because it's a string, not a bytes literal)
and as far as i can tell, that's correct
Rhodri James wrote:
On Fri, 13 Mar 2009 14:49:17 -, Beni Cherniavsky
beni.cherniav...@gmail.com wrote:
Specification
=
Allow keyword arguments in function call to take this form:
NAME ( ARGUMENTS ) = EXPRESSION
which is equivallent to the following:
NAME = lambda
Kottiyath wrote:
Hi,
I have 2 lists
a = [(4, 1), (7, 3), (3, 2), (2, 4)]
b = [2, 4, 1, 3]
Now, I want to order _a_ (a[1]) based on _b_.
i.e. the second element in tuple should be the same as b.
i.e. Output would be [(3, 2), (2, 4), (4, 1), (7, 3)]
I did the same as follows:
Hrvoje Niksic wrote:
MRAB goo...@mrabarnett.plus.com writes:
sorted(range(9), def key(n): n % 3)
[0, 3, 6, 1, 4, 7, 2, 5, 8]
Given the recent pattern of syntactic constructs for expressions using
expr keyword expr (ternary if, listcomps, genexps), and avoiding
the use of colon
MRAB wrote:
Kottiyath wrote:
Hi,
I have 2 lists
a = [(4, 1), (7, 3), (3, 2), (2, 4)]
b = [2, 4, 1, 3]
Now, I want to order _a_ (a[1]) based on _b_.
i.e. the second element in tuple should be the same as b.
i.e. Output would be [(3, 2), (2, 4), (4, 1), (7, 3)]
I did
tinn...@isbd.co.uk wrote:
What's the neatest way to do the following in case insensitive fashion:-
if stringA in stringB:
bla bla bla
I know I can just do:-
if stringA.lower() in stringB.lower():
bla bla bla
But I was wondering if there's a neater/easier way?
Not
Raymond Hettinger wrote:
Todays updates to: http://www.python.org/dev/peps/pep-0378/
* Detail issues with the locale module.
* Summarize commentary to date.
-- Opposition to formatting strings in general
(preferring a convenience function or PICTURE clause)
-- Opposition to any
Maxim Khitrov wrote:
Very simple question on the preferred coding style. I frequently write
classes that have some data members initialized to immutable values.
For example:
class Test(object):
def __init__(self):
self.some_value = 0
self.another_value = None
Similar effect
Dan Davison wrote:
I'm new to python. Could someone please explain the following behaviour
of a recursive data structure?
def new_node(id='', daughters=[]):
return dict(id=id, daughters=daughters)
n0 = new_node(id='n0')
n1 = new_node(id='n1')
[snip]
See
bieff...@gmail.com wrote:
On 14 Mar, 17:31, Dan Davison davi...@stats.ox.ac.uk wrote:
I'm new to python. Could someone please explain the following behaviour
of a recursive data structure?
def new_node(id='', daughters=[]):
return dict(id=id, daughters=daughters)
Most probably, here is
Linos wrote:
I know that this can be evident for most of the people but i would like
to know the reply and the reasoning if possible:
Should my python application have a difference in speed of execution after
change the encoding header of the file from nothing (ascii) to latin-1
or utf-8?
If
alex goretoy wrote:
I'm doing this in my code, how to make it define all this functions for
me with lambda, I've been up for a while and cant seem to figure it out,
whats the most efficient way to do it? with lambda? how? thx
def red(self,value,color='red',level='INFO'):
alex goretoy wrote:
I would imagine that I could do this with a generator and setattr, but I
am still learning how to do that kinda of codingmaybe if I had a
dictionary like this and then loaded it
d={
site_name:[s,site,'sites','site_name','site_names'],
Rhodri James wrote:
[snip]
Frankly, I'd much rather fix the locale system and extend
the format syntax to override the default locale. Perhaps
something like
financial = Locale(group_sep=,, grouping=[3])
print(my number is {0:10n:financial}.format(1234567))
It's hard to think of a way of
alex goretoy wrote:
ok now for the final result, i decided to split options out to a
separate dict of lists, does this look right to every one, I currently
have error somewhere else in my code so can't test this right now, Is
this a good method to do this? or is there another option?
[snip]
Rhodri James wrote:
On Sun, 15 Mar 2009 19:00:43 -, MRAB goo...@mrabarnett.plus.com
wrote:
Rhodri James wrote:
[snip]
Frankly, I'd much rather fix the locale system and extend
the format syntax to override the default locale. Perhaps
something like
financial = Locale(group_sep
Rhodri James wrote:
On Mon, 16 Mar 2009 02:36:43 -, MRAB goo...@mrabarnett.plus.com
wrote:
The field name can be an integer or an identifier, so the locale could
be too, provided that you know where to look it up!
financial = Locale(group_sep=,, grouping=[3])
print(my number
Rhodri James wrote:
On Mon, 16 Mar 2009 23:04:58 -, MRAB goo...@mrabarnett.plus.com
wrote:
It should probably(?) be:
financial = Locale(group_sep=,, grouping=[3])
print(my number is {0:10n:fin}.format(1234567, fin=financial))
The format 10n says whether to use separators
Ian Mallett wrote:
Hi,
I'd like to make a program that automatically runs on startup (right
after login). How should I do that?
Put it in the folder:
C:\Documents and Settings\username\Start Menu\Programs\Startup
The exact path depends on your login/username and I'm assuming that
Windows
Rhodri James wrote:
On Tue, 17 Mar 2009 01:47:32 -, MRAB goo...@mrabarnett.plus.com
wrote:
I'm not against putting a comma in the format to indicate that grouping
should be used just as a dot indicates that a decimal point should be
used. The locale would say what characters would be used
Laszlo Nagy wrote:
Hi Laszlo,
Just a hunch -- are you leaking file handles and eventually running out?
These file handles are for TCP sockets. They are accept()-ed, used and
then thrown out. I guess after the connection was closed, the file
handle is destroyed automatically. BTW here is the
Jim Garrison wrote:
[snip]
Ah. That's the Pythonesque way I was looking for.
FYI, the correct word is Pythonic. Pythonesque refers to Monty
Python.
--
http://mail.python.org/mailman/listinfo/python-list
CJ Kucera wrote:
bieff...@gmail.com wrote:
It looks like some of the C extension you are using is causing a
segfault or similar in python
interpreter (or it could be a bug in the interpreter itself, but it is
a lot less likely).
Okay... I assume by C extension you'd include the PyGTK stuff,
Mike314 wrote:
Hello,
I have following code:
def test_func(val):
print type(val)
test_func(val=('val1'))
test_func(val=('val1', 'val2'))
The output is quite different:
type 'str'
type 'tuple'
Why I have string in the first case?
It's the comma that makes the tuple, except for one
Emanuele D'Arrigo wrote:
Hi everybody,
I just had a bit of a shiver for something I'm doing often in my code
but that might be based on a wrong assumption on my part. Take the
following code:
pattern = aPattern
compiledPatterns = [ ]
compiledPatterns.append(re.compile(pattern))
Emanuele D'Arrigo wrote:
[snip]
If the answer is no, am I right to state the in the case portrayed
above the only way to be safe is to use the following code instead?
for item in compiledPatterns:
if(item.pattern == pattern):
print(The compiled pattern is stored.)
break
digz wrote:
Hi,
I am trying to convert a | delimited file to fixed width by right
padding with spaces, Here is how I have written the program , just get
the feeling this can be done in a much better ( python functional )
way rather than the procedural code i have below . Any help
appreciated
Terry Reedy wrote:
digz wrote:
Hi,
I am trying to convert a | delimited file to fixed width by right
padding with spaces, Here is how I have written the program , just get
the feeling this can be done in a much better ( python functional )
way rather than the procedural code i have below . Any
Albert Hopkins wrote:
On Thu, 2009-03-19 at 11:57 -0500, Jim Garrison wrote:
Use case: parsing a simple config file line where lines start with a
keyword and have optional arguments. I want to extract the keyword and
then pass the rest of the line to a function to process it. An obvious
use of
psaff...@googlemail.com wrote:
I'm filing 160 million data points into a set of bins based on their
position. At the moment, this takes just over an hour using interval
trees. I would like to parallelise this to take advantage of my quad
core machine. I have some experience of Parallel Python,
John Posner wrote:
[snip]
field_widths = [14, 6, 18, 21, 21, 4, 6]
out = open(/home/chatdi/ouptut.csv, 'w')
for line in open(/home/chatdi/input.csv, r):
fields = line.rstrip().split('|')
padded_fields = [field.ljust(width) for field, width in zip(fields,
field_widths)]
BJörn Lindqvist wrote:
I have a large set of documents in various text formats. I know that
each document contains its authors name, email and phone number.
Sometimes it also contains the authors home address.
The task is to find out the name, email and phone of as many documents
as possible.
Vizcayno wrote:
Hi:
I wrote a Python program which, during execution, shows me messages on
console indicating at every moment the time and steps being performed
so I can have a 'log online' and guess remaining time for termination,
I used many 'print' instructions to show those messages, i.e.
Chris Rebert wrote:
On Fri, Mar 20, 2009 at 4:34 AM, Alessandro Zivelonghi
zasaconsult...@gmail.com wrote:
Many Thanks guys!
and what if I need to look ONLY into the second and third columns,
excluding the first item of each rows?
for example if x = 3 I need to get [0] and not [0,1]
Tino Wildenhain wrote:
thomasvang...@gmail.com wrote:
You could use:
B=list(set(A)).sort()
Hope that helps.
That would leave a B with value None :-)
B=list(sorted(set(A))
could work.
sorted() accepts an iterable, eg a set, and returns a list:
B = sorted(set(A))
--
thomasvang...@gmail.com wrote:
Dear Fellow programmers,
I'm using Python scripts too organize some rather large datasets
describing DNA variation. Information is read, processed and written
too a file in a sequential order, like this
1+
1-
2+
2-
etc.. The files that i created contain
thomasvang...@gmail.com wrote:
Thanks,
This works great!
I did not know that it is possible to iterate through the file lines
with a while function that's conditional on additional lines being
present or not.
It relies on file.readline() returning an empty string when it's at the
end of the
Lada Kugis wrote:
[snip]
Normal integers are up to 10 digits, after which they become long
integers, right ?
But if integers can be exactly represented, then why do they need two
types of integers (long and ... uhmm, let's say, normal). I mean,
their error will always be zero, no matter what
Matteo wrote:
srcdata = urlopen(url).read()
dstfile = open(path,mode='wb')
dstfile.write(srcdata)
dstfile.close()
print(Done!)
Have you tried reading all files first, then saving each one on the
appropriate directory? It might work if you have enough
mattia wrote:
Can you explain me this behaviour:
s = [1,2,3,4,5]
g = (x for x in s)
next(g)
1
s
[1, 2, 3, 4, 5]
del s[0]
s
[2, 3, 4, 5]
next(g)
3
Why next(g) doesn't give me 2?
First it yields s[0] (which is 1), then you delete s[1], then it yields
s[1] (which is now 3). It doesn't
Esmail wrote:
Nick Craig-Wood wrote:
Esmail ebo...@hotmail.com wrote:
I am wondering if anyone is using python to write script files?
Yes!
..
Almost any script that contains a loop I convert into python.
In any case, the scripts are starting to look pretty hairy and I was
wondering
Daniel Fetchinson wrote:
I'd like to implement a decorator that would rename the method which
it decorates. Since it's a tricky thing in general involving all sorts
of __magic__ I thought I would ask around first before writing
something buggy :)
It should work something like this:
class
someone wrote:
Hi,
as you can see below I have some optional parameter for my query (mf,
age). They are in WHERE clause only if not empty.
In this function they are not escaped as, for example, 'search'
parameter, cause I can't pass them to execute function, which does
escaping automatically.
simon.wo...@gmail.com wrote:
Hello, all.
I don't suppose anyone has any idea why it seems to be impossible to
import any file which starts with a number? You get a syntax error,
whether the file exists or not.
Try it yourself:
import foo
ImportError: No module named foo
import 1foo
Johannes Bauer wrote:
Sebastian Bassi schrieb:
No, there is no certification for Python. Maybe in the future...
I'll hand out the Johannes Bauer Python Certificate of Total
Awesomeness for anyone who can write a hello world in python and hands
me $25000 in cash.
This whole certified foobar
jyoun...@kc.rr.com wrote:
I've got some Python code (2.5.1) that's compressing folders
on a Windows machine. When the directories get
compressed, their modification date changes. Is it possible
to grab the modification date of the folder before it's
compressed, and then set it's
1 - 100 of 4571 matches
Mail list logo