Dick Moores rcblue.com> writes:
> So now that I know better, I'm trying to write the beginnings of a
> general setPrecision() function using format strings. However, it
> appears that a variable cannot be used instead of the ".2" in
>
> "%.2f" % 2.234234
> How to do this?
You could use simpl
Pawel Kraszewski kraszewscy.net> writes:
> > > get me into trouble with the flakiness of float(n)? In testing I
> > > didn't find any problems, but ..
> >
> > Nah. Float accuracy is only a problem if you need around lots of
> > significant digits (16 or so).
>
> I wouldn't bet. Such a simple thi
>> I'm looking at the last part of the main() function:
>>
>> #
>> def main():
>> while True:
>> ...
>> again()
>> if again:
>> break
>> #
>>
>> This looks a little suspicious. What does the again() function do, and
>>
On 9/7/06, Kent Johnson <[EMAIL PROTECTED]> wrote:
> No, it doesn't. You are confused somewhere; my guess is your original
> data has newlines.
Sorry, my bad. When I created the original list I was splitting a
string in two pieces. The latter portion of the string had a newline
at the end. I had
On 08/09/06, Richard Querin <[EMAIL PROTECTED]> wrote:
> I've got a list of strings. There are some duplicates. I want a list
> of only the unique entries in that list. So I do the following:
>
> mylist = ['project1' , 'project2', 'project3', 'project4', 'project1']
>
> d = {}
>
> for item in mylis
Richard Querin wrote:
> I've got a list of strings. There are some duplicates. I want a list
> of only the unique entries in that list. So I do the following:
>
> mylist = ['project1' , 'project2', 'project3', 'project4', 'project1']
>
> d = {}
>
> for item in mylist:
> d[item] = None
>
> c
At 05:37 AM 9/7/2006, Andrei wrote:
>Dick Moores rcblue.com> writes:
>
> > (2) Is my roundingN() function OK? Is there a better way to write it?
> > Will the line
> >
> > n = round(float(n)*(10**rounding))/(10**rounding)
>
>Using format strings is easier I think. "%.2f" % 2.34234 will give
I've got a list of strings. There are some duplicates. I want a list
of only the unique entries in that list. So I do the following:
mylist = ['project1' , 'project2', 'project3', 'project4', 'project1']
d = {}
for item in mylist:
d[item] = None
cleanedlist = d.keys()
But d.keys() seems t
[Jeff]
> I read the link you sent, and I am not sure what they mean by "You
> cannot rely on __file__, because __file__ is not there in the py2exed
> main-script." can't I use _file_ in my application though? This is what
> I just added to my application and it seems to do the trick... is there
At 07:16 AM 9/7/2006, Danny Yoo wrote:
>Hi Dick,
>
>I'm looking at the last part of the main() function:
>
>#
>def main():
> while True:
> ...
> again()
> if again:
> break
>#
>
>This looks a little suspicious. What does
Thanks Bill, I read the link you sent, and I am not sure what they mean by "You cannot rely on __file__, because __file__ is not there in the py2exed main-script." can't I use _file_ in my application though? This is what I just added to my application and it seems to do the trick... is there an ex
> way. so I need to tell my program to set the working directory back to the
> installation directory... but where is this?
>
Here's what I do in my py2exe app:
installDir = os.path.dirname(os.path.abspath(sys.argv[0]))
and take a look at this link:
http://www.py2exe.org/index.cgi/WhereAmI
H
Hello,
Here is another problem:
Considering this programm:
import os, tempfile
a = tempfile.mkstemp()
f= open(a[1],'w')
f.write("foo")
f.close()
print f.name
# here some code to do some things with f
os.unlink(f.name)
The output is:
Python 2.3.3 (#51, Dec 18 2003, 20
> imex_exe=r'C:\Program Files\CMG\IMEX\2005.10\EXE\mx200510.exe'
> imex_args=('mx200510.exe','-f',imex_fil,'-wd','"'+work_dir+'"')
>
> for n in range(1,nscen):
> os.spawnv(os.P_WAIT, imex_exe, imex_args)
>
> and it seems to work. Not sure why I need to provide the name of
> the
> applicat
Dnia czwartek, 7 września 2006 14:37, Andrei napisał:
> > get me into trouble with the flakiness of float(n)? In testing I
> > didn't find any problems, but ..
>
> Nah. Float accuracy is only a problem if you need around lots of
> significant digits (16 or so).
I wouldn't bet. Such a simple thing
Hi Dick,
I'm looking at the last part of the main() function:
#
def main():
while True:
...
again()
if again:
break
#
This looks a little suspicious. What does the again() function do, and is
it supposed to return a v
>> I have to store and retrieve text files from a database table and the
>> size of each file is about 500k. Can someone give me an idea on how to
>> do this?
>>
>> Thanks,
>> Patricia
> http://dustman.net/andy/python/python-and-mysql
> Provides some background for the MySQLdb module. This shou
Dear Kent,
thanks your comment.
>> > When this program leaves from the
while loop, it doesn't terminate the
>> > comreader thread.
>>If you call self.setDaemon() here you will
mark the thread as a daemon
>>thread and it will not block the exit of the program.
It works well.
Yours sincerely,
On Thu, 2006-09-07 at 02:42 +, Patricia wrote:
> Hi,
>
> I have to store and retrieve text files from a database table and
> the size of each file is about 500k. Can someone give me an idea
> on how to do this?
>
> Thanks,
> Patricia
http://dustman.net/andy/python/python-and-mysql
Provides
Patricia gmail.com> writes:
> I have to store and retrieve text files from a database table and
> the size of each file is about 500k. Can someone give me an idea
> on how to do this?
You might want to have a look at this:
http://sourceforge.net/projects/mysql-python
Yours,
Andrei
___
Dick Moores rcblue.com> writes:
> (1) Have I handled possible user-errors OK?
I've tested it a bit and it seems to be quite robust.
> (2) Is my roundingN() function OK? Is there a better way to write it?
> Will the line
>
> n = round(float(n)*(10**rounding))/(10**rounding)
Using forma
Thanks for that Kent. I did
imex_exe=r'C:\Program Files\CMG\IMEX\2005.10\EXE\mx200510.exe'
imex_args=('mx200510.exe','-f',imex_fil,'-wd','"'+work_dir+'"')
for n in range(1,nscen):
os.spawnv(os.P_WAIT,
imex_exe, imex_args)
and it seems to work. Not sure why I need to provide the name of
Chris Hengge wrote:
> Thanks for the details, I see several code bits I'll have to play with.
>
> I got the screen clearing bit no problem, thanks for that one. I'm still
> not used to being able to just use c libraries.
The ctypes module lets you call functions in shared libraries. It is
stan
Xiao Yu Michael Yang wrote:
> Hi tutors,
>
>I am currently working on a project that identifies languages of html
> documents, using Python, of course.
You might be interested in http://chardet.feedparser.org/ which seems to
work directly on HTML.
> Just wondering, given a string:
>
>
Hi tutors,
I am currently working on a project that identifies languages of html
documents, using Python, of course. Just wondering, given a string:
str = " title this is french 77 992 / "
what is the python expression for:
1. r = return_anything_that's_within<> (str), i.e. it should giv
János Juhász wrote:
>
> Dear Tutors,
>
> ###
> from threading import Thread
> import sys
> import time
>
> # This thread would read lines from a
> # barcode scanner
> class ComThread(Thread):
> def __init__(self):
> Thread.__init__(self)
If you call s
Etrade Griffiths wrote:
> Hi
>
> I am trying to write a PYTHON script that automates the running of an
> application program MX200510.EXE under XP Pro via a DOS window. This file
> is in directory
>
> C:\Program Files\CMG\IMEX\2005.10\EXE
>
> The command line arguments are
>
> MX200510.EXE -
> I got the screen clearing bit no problem, thanks for that one. I'm
> still
> not used to being able to just use c libraries.
Even the C libraries are non standard - they aren't part of the ANSI C
definition. Its just that C libraries for the PC know what the
hardware
will look like so they can
On 9/7/06, Dick Moores <[EMAIL PROTECTED]> wrote:
I've just finished a script for converting Yen to USD, andvice-versa. A simple, even silly thing to do (a friend asked me to
write it for him--probably just to humor me), but I have tried tobuild in some bells and whistles. In doing so, some questi
Thanks for the details, I see several code bits I'll have to play with.
I got the screen clearing bit no problem, thanks for that one. I'm still
not used to being able to just use c libraries.
I don't actually have a need to draw the cursor all over the screen for
any practical application eith
I've just finished a script for converting Yen to USD, and
vice-versa. A simple, even silly thing to do (a friend asked me to
write it for him--probably just to humor me), but I have tried to
build in some bells and whistles. In doing so, some questions arose.
If some of you Tutors could take l
Dear Tutors,
###
from threading import Thread
import sys
import time
# This thread would read lines from a
# barcode scanner
class ComThread(Thread):
def __init__(self):
Thread.__init__(self)
def run(self):
while 1:
ti
Hi
I am trying to write a PYTHON script that automates the running of an
application program MX200510.EXE under XP Pro via a DOS window. This file
is in directory
C:\Program Files\CMG\IMEX\2005.10\EXE
The command line arguments are
MX200510.EXE -f "temp.dat" -wd "C:\Projects\Vitol\New
busin
Replying to the List
The trick is to know either that Fred works at Pythonware,
or that his nickname is the effbot... :-)
http://effbot.org/downloads/
Sorry, neither are intuitively obvious... but he has lots of goodies
on his site, worth perusing the list. And Fred's code is usually
of a ve
> hello, I created an executable using py2exe and innosetup for
> windows.
> I need to figure out where the user has installed my program
> so that I can direct the program to the installation files that it
> needs to run.
The location of the installation files - I assume you mean some
kind of c
Nice to have you around! This list is to help with
any problem you may be having with the language and how to solve certain
problems.
So, if you have specific questions, please do post
them. And be warned, no one here would like to do any homework for
you.
Enjoy you stay
Dom
- O
36 matches
Mail list logo