"Jay Mutter III" <[EMAIL PROTECTED]> wrote
> for line in s:
> jay = patno.findall(line)
> jay2 = "".join(jay[0])
> print jay2
>
> and it prints fine up until line 111 which is a line that had
> previously returned [ ] since a number didn't exist on that line and
> then exits with
> I
Or you can try something like:
x = r"C:\My\Doc\;D:\backup"
x = x.replace("\\", ";")
x = x.split(";")
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Kent Johnson
Sent: Saturday, March 31, 2007 9:42 PM
To: Andrei Petre
Cc: tutor@python.org
Subject: Re: [
Andrei Petre wrote:
> I want to split a string like "C:\My\Doc\;D:\backup\" with two
> separators: \ and ;
> I found that \ is handled with /raw string/ notation r"". But the
> problem i encountered is with split() function.
> In the 2.5 reference is said that "The sep argument of the split()
>
Kent;
Again thanks for the help.
i am not sure if this is what you menat but i put
for line in s:
jay = patno.findall(line)
jay2 = "".join(jay[0])
print jay2
and it prints fine up until line 111 which is a line that had
previously returned [ ] since a number didn't exist on that
"Peter" <[EMAIL PROTECTED]> wrote
> Is there a way to detect errors when running shell commands using
> os.popen?
You have to parse the programs output.
Usually errors will appear on stderr so you need to read that as
well as stdout.
This may be slightly easier using the new subprocess module
a
Hello all,
I'm brand new to the mxODBC module from egenix (like yesterday). I currently
use the module for data laundering. I connect to a Microsoft Access .mdb and
perform some SQL queries on tables. Almost everything is going fine.
However, I can't find out how to create a new table. Even other
Very valid points, I was not aware that MD5 had been cracked :)
Dave
___
Tutor maillist - Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor
I think by "multiple characters" they mean more than one character for
ONE separator. I don't know how to specify multiple separators. You
could try something like this:
s = "spam;egg mail"
list = []
for t in s.split(";"):
for u in t.split(" "):
list.append(u)
which yields:
list = ['
I want to split a string like "C:\My\Doc\;D:\backup\" with two separators: \
and ;
I found that \ is handled with *raw string* notation r"". But the problem i
encountered is with split() function.
In the 2.5 reference is said that "The sep argument of the split() function
may consist of multiple c
Hello Jay,
Jay Mutter III wrote:
> but still haven't gotten he first one.
>
>> for line in s:
>> jay = patno.findall(line)
>> print jay
>>
>> which yields the following
>>
>> [('1', '337', '912')]
>> [('1', '354', '756')]
>> if i try to write to a file instead of print to the screen usi
Jay Mutter III wrote:
> I have the following that I am using to extract "numbers' from a file
> ...
> which yields the following
>
> [('1', '337', '912')]
> ...
> So what do i have above ? A list of tuples?
Yes, each line is a list containing one tuple containing three string
values.
> How do
Ok after a minute of thought I did solve my second question by simply
changing my RE to
(r'(\d{1}[\s,.]+\d{3}[\s,.]+\d{3})')
but still haven't gotten he first one.
On Mar 31, 2007, at 1:39 PM, Jay Mutter III wrote:
> I have the following that I am using to extract "numbers' from a file
>
>
>
I have the following that I am using to extract "numbers' from a file
prompt1 = raw_input('What is the file from which you would like a
list of patent numbers? ')
p1 = open(prompt1,'rU')
s = p1.readlines()
prompt2 = raw_input('What is the name of the file to which you would
like to save
Is there a way to detect errors when running shell commands using
os.popen? I'm trying to get an ip address for ethernet interfaces, and
if an interface doesn't exist I get an error from the shell command. I
tried using try and except, but that did seem to work.
Thanks in advance.
Peter
Dhiraj Sharma schrieb:
> 1. Is it possible to cancel (kill) a "child" thread from the main thread
> in Python running on Windows?
If you have control over the code of the thread, it could periodically check
(in it's "run" method) an Event or Queue object, whether it should exit. See
http://www.pyt
On Saturday 31 March 2007 07:07, Dhiraj Sharma wrote:
> I would appreciate help on two related questions:
>
> 1. Is it possible to cancel (kill) a "child" thread from the main
> thread in Python running on Windows?
I don't think so. If you want to kill part of the program you must run
it in a dif
On 3/31/07, Dhiraj Sharma <[EMAIL PROTECTED]> wrote:
> 2. Also, is it possible to cancel (abort) a blocking read (say, to stdin) in
> a function that can be called by a timer? The goal is to cancel the read if
> input is not forthcoming within a specified time.
For Windows, no idea. For Unix I'd
I would appreciate help on two related questions:
1. Is it possible to cancel (kill) a "child" thread from the main thread in
Python running on Windows?
2. Also, is it possible to cancel (abort) a blocking read (say, to stdin) in a
function that can be called by a timer? The goal is to cancel
On 30 Mar 2007 20:23:00 -0400, Greg Perry <[EMAIL PROTECTED]> wrote:
> Yeah I figured that. I am trying to find a way to have the program detect if
> the user input is a file or directory, which is easy enough with os.path.
> However, os.path makes no distinction between a regular file and a ma
Greg Perry schreef:
> Yeah I figured that. I am trying to find a way to have the program
> detect if the user input is a file or directory, which is easy enough
> with os.path. However, os.path makes no distinction between a
> regular file and a mask, eg filename.txt or *.txt. I guess I'll have
On 3/31/07, Kirk Bailey <[EMAIL PROTECTED]> wrote:
> I replied off list due to just clicking reply, not replyall, and this
> list is not set up with a replyto header. so away it went.
Youre not the first one, and definately not the last one...
--
- Rikard - http://bos.hack.org/cv/
_
21 matches
Mail list logo