Andrew Robert wrote:
The python method inserts extra blank lines after each hex value line.
Does anyone know why this might be?
Is the print statement inserting a artificial new line character?
Yes, this is a feature of print, it always inserts a newline. To avoid
this, use
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Great!
Taking this a little further along, I wrote the converted file to a new
file using:
import re,sys
output = open(r'e:\pycode\out_test.txt','wb')
for line in open(r'e:\pycode\sigh.txt','rb') :
output.write( re.sub(r'([^\w\s])', lambda s:
Andrew Robert wrote:
Taking this a little further along, I wrote the converted file to a new
file using:
import re,sys
output = open(r'e:\pycode\out_test.txt','wb')
for line in open(r'e:\pycode\sigh.txt','rb') :
output.write( re.sub(r'([^\w\s])', lambda s: '%%%2X' %
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi all,
I tried:
output = open(r'e:\pycode\new_test.txt','wb')
for line in open(r'e:\pycode\out_test.txt','rb') :
output.write( re.sub(r'([^\w\s])', lambda s: chr(int(s.group(),
16))) % ord(s.group()), line))
This generated the traceback:
Andrew Robert wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi all,
I tried:
output = open(r'e:\pycode\new_test.txt','wb')
for line in open(r'e:\pycode\out_test.txt','rb') :
output.write( re.sub(r'([^\w\s])', lambda s: chr(int(s.group(),
16))) % ord(s.group()), line))
for line in open(r'e:\pycode\out_test.txt','rb') :
output.write( re.sub(r'([^\w\s])', lambda s: chr(int(s.group(),
16))) % ord(s.group()), line))
Let's add some whitespace.
output.write(re.sub(r'([^\w\s])',
lambda s: chr(
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
When I alter the code to:
import re,sys
output = open(r'e:\pycode\new_test.txt','wb')
for line in open(r'e:\pycode\out_test.txt','rb') :
output.write( re.sub(r'([^\w\s])', lambda s: chr(int(s.group(), 16)))
, line)
output.close()
I get the
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
lol..
Glutton for punishment I guess.
I tried removing the last parentheses but I then get an error that two
arguments are passed when three are expected.
Danny Yoo wrote:
for line in open(r'e:\pycode\out_test.txt','rb') :
output.write(
Andrew Robert wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
When I alter the code to:
import re,sys
output = open(r'e:\pycode\new_test.txt','wb')
for line in open(r'e:\pycode\out_test.txt','rb') :
output.write( re.sub(r'([^\w\s])', lambda s: chr(int(s.group(), 16)))
,
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi Kent,
Sorry for causing so much trouble.
I am not married to either a single or multi-line solution one way or
another.
Just a solution that works.
Based on something by Danny Yoo provided, I had started with something like:
import
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi Everyone,
Thanks for all of your patience on this.
I finally got it to work.
Here is the completed test code showing what is going on.
Not cleaned up yet but it works for proof-of-concept purposes.
#!/usr/bin/python
import re,base64
#
On Thu, 25 May 2006, Alan Gauld wrote:
In general I prefer to use string formatting to convert into hex
format.
I'm a big fan of hexlify:
from binascii import hexlify
s=abc-123
hexlify(s)
'6162632d313233'
___
Tutor maillist -
for line in open(r'e:\pycode\out_test.txt','rb') :
output.write( re.sub(r'([^\w\s])', lambda s: chr(int(s.group(),
16))) % ord(s.group()), line))
This generated the traceback:
File E:\pycode\sample_decode_file_specials_from_hex.py, line 8
output.write( re.sub(r'([^\w\s])', lambda s:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi Everyone,
I have two Perl expressions
If windows:
perl -ple s/([^\w\s])/sprintf(q#%%%2X#, ord $1)/ge somefile.txt
If posix
perl -ple 's/([^\w\s])/sprintf(%%%2X, ord $1)/ge' somefile.txt
The [^\w\s] is a negated expression stating that
perl -ple s/([^\w\s])/sprintf(q#%%%2X#, ord $1)/ge somefile.txt
Hi Andrew,
Give me a second. I'm trying to understand the command line switches:
(Looking in 'perl --help'...)
-p assume loop like -n but print line also, like sed
-l[octal] enable line ending
On 24 Mai 2006, [EMAIL PROTECTED] wrote:
I have two Perl expressions
If windows:
perl -ple s/([^\w\s])/sprintf(q#%%%2X#, ord $1)/ge somefile.txt
If posix
perl -ple 's/([^\w\s])/sprintf(%%%2X, ord $1)/ge' somefile.txt
The [^\w\s] is a negated expression stating that any character
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Wow!!..
That awesome!
My goal was not to make it a one-liner per-se..
I was simply trying to show the functionality I was trying to duplicate.
Boiling your one-liner down into a multi-line piece of code, I did:
#!c:\python24\python
import
[forwarding to tutor, although it looks like Andrew's making some good
headway from other messages]
-- Forwarded message --
Date: Wed, 24 May 2006 14:59:43 -0400
From: Andrew Robert [EMAIL PROTECTED]
To: Danny Yoo [EMAIL PROTECTED]
Subject: Re: [Tutor] Question on regular
Andrew Robert wrote:
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Wow!!..
That awesome!
My goal was not to make it a one-liner per-se..
I was simply trying to show the functionality I was trying to duplicate.
Boiling your one-liner down into a multi-line piece of code, I did:
a = open(r'e:\pycode\csums.txt','rb').readlines()
for line in a:
print re.sub(r'([^\w\s])', lambda s: '%%%2X' % ord(s.group()),
line)
Or just
for line in open(r'e:\pycode\csums.txt','rb'):
print.
Breaking down the command, you appear to be calling an un-named
function
to act
Your code put me right on track.
- From that point, I crafted the following code.
What is confusing is how to take the captured character and
transform it
into a 3 digit hex value.
In general I prefer to use string formatting to convert into hex
format.
print %3X% % myValue
you can
MAC OS version 10.4.6
Python Version 2.4.1
Problem is that the url is valid but the python icglue tells me that
it is not found
Please help
Error
Traceback (most recent call last):
File dialect.py, line 166, in ?
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi Everyone,
I have a program that I'd would like to enhance flexibility in calling.
Is there a way to leverage optionparser so it can accept input from both
command line and a configuration file?
Current code block is:
#
# Parse command
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Hi Kent,
If I understood correctly, you meant something like this?
#
# Parse command line options and automatically build help/usage
# display
#
if len(sys.argv) == 2:
infile= open(sys.argv[1],rb).read()
On 16 Mai 2006, [EMAIL PROTECTED] wrote:
Is there a way to leverage optionparser so it can accept input from both
command line and a configuration file?
Current code block is:
#
# Parse command line options and automatically build
# help/usage display
#
parser =
Hi list,
I am launching another python program in my python daemon like this:
pobj = subprocess.Popen(tlsmd,
stdin = subprocess.PIPE,
stdout = subprocess.PIPE,
stderr = subprocess.STDOUT,
I have made scripts that work on many files (sometimes just some tens)
and appears that filesystem structure caching in Linux is very
efficient. That's why it runs very fast later.
I've seen this in Slackware, Debian, and RH, so I guess it's just a
linux/FS/disk thing.
Try doing 'find'
I have been using python for sometime...and occasionally I noticed
significant delay before the code would run but unitl now I have been able
to write it off to other things. Now I have a short script that I wrote to
check some files and print out a few lines.
I have noticed that usually the
Ertl, John wrote:
I have been using python for sometime...and occasionally I noticed
significant delay before the code would run but unitl now I have been able
to write it off to other things. Now I have a short script that I wrote to
check some files and print out a few lines.
I have
PROTECTED]
Sent: Tuesday, May 02, 2006 12:06 PM
To: Ertl, John
Cc: tutor@python.org
Subject:Re: [Tutor] question about run time
Ertl, John wrote:
I have been using python for sometime...and occasionally I noticed
significant delay before the code would run but unitl now I have been
PROTECTED]
Sent: Tuesday, May 02, 2006 12:06 PM
To: Ertl, John
Cc: tutor@python.org
Subject: Re: [Tutor] question about run time
Ertl, John wrote:
I have been using python for sometime...and occasionally I noticed
significant delay before the code would run but unitl now I have
Cc: tutor@python.org
Subject:Re: [Tutor] question about run time
Ertl, John wrote:
Kent,
The files are very small (a few hundred lines). Maybe it is a network
issue? But then why is it always slow the first time in the morning? I
don't know network stuff but that seams a bit
I have been using python for sometime...and occasionally I noticed
significant delay before the code would run but unitl now I have been
able to write it off to other things. Now I have a short script that I
wrote to check some files and print out a few lines.
I have noticed that
myUse.sendEmail(%s memory/inode limit reached on gpfs %
myUse.userName)
-Original Message-
From: Danny Yoo [mailto:[EMAIL PROTECTED]
Sent: Tuesday, May 02, 2006 1:32 PM
To: Ertl, John
Cc: tutor@python.org
Subject:Re: [Tutor] question about run time
I have been using python
Hi John,
You can try something like the profiler, which will say where most of the
program's time is being spent. We can find documentation on the Python
profiler here:
http://www.python.org/doc/lib/profile.html
From a rough, low-level standpoint, there are tools like 'top' on Linux
Kent Johnson schrieb:
Gregor Lingl wrote:
Hi all of you,
...
from copy import deepcopy
class Vec(tuple):
def __new__(cls, x, y):
return tuple.__new__(cls, (x,y))
def __abs__(self):
return (self[0]**2+self[1]**2)**0.5
## more methods ...
Gregor Lingl wrote:
Thanks, Kent for the hint. It works (of course).
Skimming through this part of the docs I discovered, that there is a
special method __deepcopy__. So I also tried using this, adding
def __deepcopy__(self,visit):
return self
to my Vec class,
Kent Johnson schrieb:
Gregor Lingl wrote:
Thanks, Kent for the hint. It works (of course).
Skimming through this part of the docs I discovered, that there is a
special method __deepcopy__. So I also tried using this, adding
def __deepcopy__(self,visit):
return self
Hi all of you,
I've some Vector class, which is a subclass of tuple and which is
working satisfactorily since long in different contexts. Now I've
constructed objects with attributes of Vec-type, which I wanted to
deepcopy. But that doesn't work, because I can't (deep)copy Vec-s:
from copy
Gregor Lingl wrote:
Hi all of you,
I've some Vector class, which is a subclass of tuple and which is
working satisfactorily since long in different contexts. Now I've
constructed objects with attributes of Vec-type, which I wanted to
deepcopy. But that doesn't work, because I can't
On 4/11/06, Kent Johnson [EMAIL PROTECTED] wrote:
There is no need to pass the class object in to the function, you cancreate it in the function and return it. A class might be nice becauseit gives names to the various values. A dict can also be used for this.
Do what feels right :-)To be more
Richard Querin wrote:
On 4/11/06, *Kent Johnson* [EMAIL PROTECTED] mailto:[EMAIL PROTECTED]
wrote:
There is no need to pass the class object in to the function, you can
create it in the function and return it. A class might be nice because
it gives names to the various
Hello,
I have a list: list1 = [ 'spam!', 2, ['Ted', 'Rock']
]
and I wrote the script below:
i = 0
while i len(list1):
print list1[i]
i += 1
Ok. This script will generate as the output each
element of the original list, one per line:
spam!
2
['Ted', 'Rock']
I also would like to print
Hi Hoffmann,
On 11/04/06, Hoffmann [EMAIL PROTECTED] wrote:
I have a list: list1 = [ 'spam!', 2, ['Ted', 'Rock'] ]
and I wrote the script below:
i = 0
while i len(list1):
print list1[i]
i += 1
Have you read about for loops? The pythonic way of looping through
a list is to do
Hi Hoffman,
It is often useful to use the for construct to process items in a list.
e.g.:
list1 = [ 'spam!', 2, ['Ted', 'Rock']]
for item in list:
...print item
spam!
2
['Ted', 'Rock']
If you pass a list to the len() function, it will return the number of
elenents in the list. e.g.:
x
--- John Fouhy [EMAIL PROTECTED] wrote:
Hi Hoffmann,
On 11/04/06, Hoffmann [EMAIL PROTECTED] wrote:
I have a list: list1 = [ 'spam!', 2, ['Ted',
'Rock'] ]
and I wrote the script below:
i = 0
while i len(list1):
print list1[i]
i += 1
Have you read about for loops?
On Mon, 10 Apr 2006, Hoffmann wrote:
Hello,
I have a list: list1 = [ 'spam!', 2, ['Ted', 'Rock']
]
and I wrote the script below:
i = 0
while i len(list1):
print list1[i]
i += 1
Ok. This script will generate as the output each
element of the original list, one per line:
On Mon, 10 Apr 2006, Hoffmann wrote:
I also would like to print the length of each element
of that list:
spam! = 1 element
2 = 1 element
['Ted', 'Rock'] = 2 elements
Could anyone, please, give me some hints?
The problem is slightly weird, just because you need to clarify what it
--- Terry Carroll [EMAIL PROTECTED] wrote:
On Mon, 10 Apr 2006, Hoffmann wrote:
Hello,
I have a list: list1 = [ 'spam!', 2, ['Ted',
'Rock']
]
and I wrote the script below:
i = 0
while i len(list1):
print list1[i]
i += 1
Ok. This script will generate as the
--- Matthew White [EMAIL PROTECTED] wrote:
Hi Hoffman,
It is often useful to use the for construct to
process items in a list.
e.g.:
list1 = [ 'spam!', 2, ['Ted', 'Rock']]
for item in list:
...print item
spam!
2
['Ted', 'Rock']
If you pass a list to the len() function, it
On Wed, 2006-04-05 at 12:34 +0100, Alan Gauld wrote:
Suppose you have a situation where you have a large number of command-line
options that you will parse with getopt. You want to keep track of these
as you move around in the code and do various things.
Is it more Pythonic to:
Have
Dana Robinson wrote:
Have the functions take large numbers of parameters.
or
Create an options class to pass the options around.
Pythonically, I heard the distinct scream of DICTIONAR in my head.
Hugo
___
Tutor maillist -
I have blocks of text (in notebook files currently) that I need to read 3
and analyse 3 characters at a time. [This is because I'm studying genes and
codons are three characters in length]. How do I do this using python? I've
currently only been able to find ways of analysing text line by line,
On Mon, 20 Feb 2006, Samantha Warbey wrote:
I have blocks of text (in notebook files currently) that I need to read
3 and analyse 3 characters at a time. [This is because I'm studying
genes and codons are three characters in length]. How do I do this using
python? I've currently only been
ok, so i have sparce documentation from a server that i need to make a
socket connection with.
the server wants to get info a certain way. Each message has to start
with an ascii STX (literally the three letters, not the standart ascii
'STX') then it has to have another four bytes that give the
the server wants to get info a certain way. Each message has to start
with an ascii STX (literally the three letters, not the standart ascii
'STX') then it has to have another four bytes that give the length of
the message, then the message itself, then end with an ascii ENX
(again,the three
On Mon, 19 Dec 2005, Krava Magare wrote:
How can I remove and add record ( dictionary type) to a file.
Hi Krava,
H... I have to admit that I don't understand the question yet.
*grin*
It looks like you're already pickling lists into your file. Picking
dictionaries should be similar;
Krava Magare said unto the world upon 2005-12-19 17:31:
How can I remove and add record ( dictionary type) to a file. This is the
program that I'm working on: the program should create a text file, print
the contents of the text file, read the file after it's been created, add a
record
How can I remove and add record ( dictionary type) to a file. This is the program that I'm working on: the program should create a text file, print the contents of the text file, read the file after it's been created, add a record and print the contents of the file, remove a record(s) from the
I am a bit new to the *nix environment, as well as brand new
to Python (perhaps I am biting of a bit much, I know). I was wondering if
someone could point me in a direction to get started in this environment. What
apps to code in, is there an interactive mode? Specifically FreeBSD 6.0
On 30/11/05, Douglass, Erik [EMAIL PROTECTED] wrote:
I am a bit new to the *nix environment, as well as brand new to Python
(perhaps I am biting of a bit much, I know). I was wondering if someone
could point me in a direction to get started in this environment. What apps
to code in, is there
I am a bit new to the *nix environment, as well as brand new to Python
(perhaps I am biting of a bit much, I know). I was wondering if
someone could point me in a direction to get started in this
environment.
Hi Erik,
I agree; I'd recommend getting used to operating your new Unix
The device at the far end of the serial connection is echoing what you
write back to you. This is a convenience for someone typing at a
terminal, but a nuisance when you are programming.
The easier way out is to turn echoing off at the far device. Failing
that, you will want to provide a copy
nephish wrote:
Hey there,
i am using a script to change a byte into an integer
like this:
a = the byte
value = ord(a)
but i cant find the operation that can change it back to a byte.
chr()
See http://docs.python.org/lib/built-in-funcs.html
Kent
--
] [mailto:[EMAIL PROTECTED] On Behalf
Of nephish
Sent: Wednesday, 16 November 2005 9:46 a.m.
To: tutor
Subject: [Tutor] question about ord
Hey there,
i am using a script to change a byte into an integer
like this:
a = the byte
value = ord(a)
but i cant find the operation
chr(value)
chr(ord('a')) == 'a'
True
On Tue, 2005-11-15 at 14:46 -0600, nephish wrote:
Hey there,
i am using a script to change a byte into an integer
like this:
a = the byte
value = ord(a)
but i cant find the operation that can change it back to a byte.
i am sure its
)
You nmay want to check the docs for the struct module at python.org on that
pattern.
Liam Clarke-Hutchinson
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of nephish
Sent: Wednesday, 16 November 2005 9:46 a.m.
To: tutor
Subject: [Tutor
Hey there,
i am developing on a linux computer with the serial module. Now, i
already am able to recieve info from a serial RS232 device and process
everything ok. What i need to do now is write to the serial device, but
i also need to be able to not interrupt the script that is reading
Hi Nephish,
Are you using pyserial or rolling your own? Normally you can write and
read to the /dev/ttySXX file at the same time; since they're special
files, not ordinary files, the driver handles that.
Handling both writing and reading in your program's flow control is a
wholly different
Yeah, i am using pyserial, i think, in debian its called python serial
and i use import serial to get things going.
Really easy, just wanted to know about this stuff before i start
scrambling this like so many eggs.
i will not be using two different scripts, but likely two threads in the
same
: tutor
Subject: Re: [Tutor] question about serial coms
Hi Nephish,
Are you using pyserial or rolling your own? Normally you can write and read to
the /dev/ttySXX file at the same time; since they're special files, not
ordinary files, the driver handles that.
Handling both writing and reading
and another one to handle the writes.
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Hugo González
Monteverde
Sent: Tuesday, 15 November 2005 7:36 a.m.
To: nephish
Cc: tutor
Subject: Re: [Tutor] question about serial coms
Hi Nephish,
Are you using
port
Release lock
Cheers
Hans
-Original Message-
From: nephish [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 15 November 2005 10:47 a.m.
To: Hans Dushanthakumar
Cc: Hugo González Monteverde; tutor
Subject: RE: [Tutor] question about serial coms
well thats encouraging, did you have to do
: Hugo González Monteverde; tutor
Subject: RE: [Tutor] question about serial coms
ok, lock is something you wrote yourself ?
i can't find it in the docs. However, i think i can essentially build the same
thing.
the serial module i use is pyserial. pyserial.sourceforge.net.
the docs are a wee bit
Hans
-Original Message-
From: nephish [mailto:[EMAIL PROTECTED]
Sent: Tuesday, 15 November 2005 11:23 a.m.
To: Hans Dushanthakumar
Cc: Hugo González Monteverde; tutor
Subject: RE: [Tutor] question about serial coms
ok, lock is something you wrote yourself ?
i can't find
PROTECTED]
Sent: Tuesday, 15 November 2005 11:23 a.m.
To: Hans Dushanthakumar
Cc: Hugo González Monteverde; tutor
Subject: RE: [Tutor] question about serial coms
ok, lock is something you wrote yourself ?
i can't find it in the docs. However, i think i
can essentially build the same
]
Sent: Tuesday, 15 November 2005 10:47 a.m.
To: Hans Dushanthakumar
Cc: Hugo González Monteverde; tutor
Subject: RE: [Tutor] question about serial coms
well thats encouraging, did you have to do
anything special to prevent an error when trying to
read or write
PROTECTED]
Sent: Tuesday, 15 November 2005 2:10 p.m.
To: [EMAIL PROTECTED]
Cc: Hans Dushanthakumar; tutor
Subject: Re: [Tutor] question about serial coms
oh yeah, i will need this too!
sk
On Mon, 2005-11-14 at 17:04 -0800, Bennett, Joe wrote:
I have been working with pyserial. One question I have
I think so, what I'm doing is opening a text file,
reading line 1 and writing that text to the serial
port. Then read line 2 and so on... So it mimics a
string rather than a list or dictionary. But I would
think this would give you a similiar result. I can try
it to confirm.
Here is the entire
Subject: Re: [Tutor] Question about resetting values
I am writing a Blackjack program, and was wondering how to reset the
values to zero, e.g. cash = 0?
Yes, that's how you do it. Now what is the bit you don't understand?
Alan G
Author of the Learn to Program web tutor
http
- -: \d+/?\d*
- -
- -ie 1 or more digits followed by 0 or 1 slashes followed by 0 or more
digits.
this looks like it'll also accept invalid data, such as 1/ ... i
think there's some more tweaking involved to get it so that if there's
a '/', there is at least one digit afterwards.
-- wesley
w chun wrote:
- -: \d+/?\d*
- -
- -ie 1 or more digits followed by 0 or 1 slashes followed by 0 or more
digits.
this looks like it'll also accept invalid data, such as 1/ ... i
think there's some more tweaking involved to get it so that if there's
a '/', there is at least one digit
and i am using some try / except statements.
the problem is, that even though my script does not crash, i dont know
the exact error.
IT sounds like your try/except is masking the error.
Its usually a good idea to NOT Use try/except when developing your
code, then go back and put it in when
OR tests for the truth of the first thing then the truth of the second.
The first part of your OR is always true, so it doesn't test the second.
What you really want to do is look for a digit and then look for more
digits or a slash and some more digits.
So:
: \d(\d+|/\d+)
but this is easier
nephish wrote:
Hey there,
i am writing some (for me) pretty complicated stuff for work that
really needs to work.
i have looked at exception handling in the Learning Python book.
and i am using some try / except statements.
the problem is, that even though my script does
On 10/26/05, nephish [EMAIL PROTECTED] wrote:
Yeah, cool. i am just starting this part.
i am glad i started with python.
thanks for the help
if your app is willing to tolerate errors/crashes, then i would take
alan's advice and just letting the errors happen, as opposed to being
so careful
w chun wrote:
if your app is willing to tolerate errors/crashes, then i would take
alan's advice and just letting the errors happen, as opposed to being
so careful with (and integrating Kent's suggestion for the full
traceback with):
try:
BLOCK
except Exception, e:
print e,
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
Today (Oct 27, 2005) at 9:29am, Ed Singleton spoke these wise words:
- -OR tests for the truth of the first thing then the truth of the second.
- -
- -The first part of your OR is always true, so it doesn't test the second.
- -
- -What you really
Hey there,
i am writing some (for me) pretty complicated stuff for work that
really needs to work.
i have looked at exception handling in the Learning Python book.
and i am using some try / except statements.
the problem is, that even though my script does not crash, i
Yes,
You can catch an error object along with the exception, as in:
try:
fileo = open(nofile)
except IOError, e:
print Alas..., e
As you see, the error object has a string representation equal wo what
normally the python interpreter prints...
Alas... [Errno 2] No such file or
Thanks Hugo,
Now that i know where to look
appreciate your help.
-sk
On Wed, 2005-10-26 at 21:27 -0600, Hugo González Monteverde wrote:
Yes,
You can catch an error object along with the exception, as in:
try:
fileo = open(nofile)
except IOError, e:
print Alas..., e
As
i am writing some (for me) pretty complicated stuff for work that
really needs to work.
i have looked at exception handling...
and i am using some try / except statements.
the problem is, that even though my script does not crash, i dont know
the exact error.
Yeah, cool. i am just starting this part.
i am glad i started with python.
thanks for the help
sk
On Wed, 2005-10-26 at 21:32 -0700, w chun wrote:
i am writing some (for me) pretty complicated stuff for work that
really needs to work.
i have looked at exception handling...
Hey there,
i have a simple app that plots some numbers sent by a field sensor with
respect to time. i am trying to do this in pychart, but the problem is,
when the numbers come in, they do so at almost random times.
y shows the value sent by the sensor
x plots the time that the value came in.
Hi Negroup,
First off, you may want to use os.path.join to create paths -
path = 'categories/%s' % self.name
could be -
path = os.path.join(categories, self.name)
This will ensure minimum hassle if you ever want to use this across
multiple OS.
Also, it looks a little tidier, and IMAO,
Erk, I of course meant -
path = os.path.join('categories', self.name)
On 8/10/05, mailing list [EMAIL PROTECTED] wrote:
Hi Negroup,
First off, you may want to use os.path.join to create paths -
path = 'categories/%s' % self.name
could be -
path = os.path.join(categories, self.name)
Nathan Pinno said unto the world upon 2005-08-09 23:31:
Say I deal 5 cards, and then list them. How would I print the list
of cards, with the numbers of each card(the position in the list)?
Then delete a certain card or cards, based upon the user's choice?.
Nathan
Nathan,
I write this
Say I deal 5 cards, and then list them. How would I print the list of
cards, with the numbers of each card(the position in the list)? Then delete a
certain card or cards, based upon the user's choice?.
Nathan
---Early to
bed,Early
Say I deal 5 cards, and then list them. How would I print the list of
cards, with the numbers of each card(the position in the list)? Then delete
a certain card or cards, based upon the user's choice?.
hope this points you in the right direction Nathan.
-Luke
#start of program
The book, Programming Python, shows an example of os.chdir() on the
Windows platform, as follows:
os.chdir(r'c:\temp')
What's the 'r' for? It didn't seem to make any difference in how
Python works - at least not on the surface.
Thanks,
Don
--
DC Parris GNU Evangelist
http://matheteuo.org/
801 - 900 of 946 matches
Mail list logo