Re: [Tutor] need some help with ascii hex

2005-08-18 Thread nephish
Alan G wrote: > Hi Francois, > >> I'm not a Tutor but I found this wich could help you: > > > If you are on the tutor list you are a tutor. We don't have any division > of role, everyone helps and everuone can ask for help. We are all equals. > >> To convert character data to integers, you can use

Re: [Tutor] need some help with ascii hex

2005-08-18 Thread francois schnell
On 19/08/05, Alan G <[EMAIL PROTECTED]> wrote: If you are on the tutor list you are a tutor. We don't have anydivisionof role, everyone helps and everuone can ask for help Ok I wasn't sure about the [Tutor] stuff  :) . We are allequals. Well, actually  this is not true:  it is well  known here in

Re: [Tutor] Linux/Window Differences in Python?

2005-08-18 Thread Alan G
> I use Debian Linux at home and XP at work. > Are there any differences in Python between operating systems There ate not really any differences in Python itself but there are some differences in the modules available. If you go to the documentation page on the web site and look at the Module

Re: [Tutor] need some help with ascii hex

2005-08-18 Thread Alan G
Hi Francois, > I'm not a Tutor but I found this wich could help you: If you are on the tutor list you are a tutor. We don't have any division of role, everyone helps and everuone can ask for help. We are all equals. > To convert character data to integers, you can use the ord() > function, and

Re: [Tutor] Is there anyway to set how many numbers are used after the decimal in floating numbers?

2005-08-18 Thread Bob Gailer
At 11:17 AM 8/18/2005, Nathan Pinno wrote: >I want to use it for a currency exchange program. It's useful, then the user >wouldn't have to round it himself/herself, and mistakes could be avoided. That is what the decimal module is for. I suggest you use it. Bob Gailer 303 442 2625 home 720 938 26

Re: [Tutor] Need help with serial input

2005-08-18 Thread Alan G
Hi Shawn, > i am using the serial module and trying to get some info over an > RS232 port. Seems to be comming in ok, but when i print it out, its > in ASCII instead of hex. Thats because print interprets sequences of bytes as ASCII codes. The bytes you read from serial are just binary numbers

Re: [Tutor] Is there anyway to set how many numbers are used afterthe decimal in floating numbers?

2005-08-18 Thread Alan G
>I want to use it for a currency exchange program. It's useful, then >the user > wouldn't have to round it himself/herself, and mistakes could be > avoided. For currency you need to use the decimal module. Normal floating point numbers are far too inaccurate for reliable currency conversion. T

Re: [Tutor] Is there anyway to set how many numbers are used after thedecimal in floating numbers?

2005-08-18 Thread Alan G
> Is there anyway to set how many numbers are used after > the decimal in floating numbers? There are a couple of options. Usually you just want to display the 2 digit accuracy but keep the real value as accurate as possible. The easiest way to do that is to use format strings (as described in

Re: [Tutor] Linux/Window Differences in Python?

2005-08-18 Thread Danny Yoo
On Thu, 18 Aug 2005, Catherine Kostyn wrote: > Are there any differences in Python between operating systems or is it > really compatible with the majority of operating systems? Hi Catherine, Python does support platform-dependent extensions, and those are used for things like integrating in

Re: [Tutor] Is there anyway to set how many numbers are used after the decimal in floating numbers?

2005-08-18 Thread Danny Yoo
On Thu, 18 Aug 2005, Nathan Pinno wrote: > Is there anyway to set how many numbers are used after the decimal in > floating numbers? It would be nice if the answer could be rounded to 2 > decimal spots, instead of the ten millionths spot. Hi Nathan, If you want to print a number with two decim

[Tutor] Linux/Window Differences in Python?

2005-08-18 Thread Catherine Kostyn
I use Debian Linux at home and XP at work. I suspect the question to my answer is *no* but I am going to ask anyway :)   Are there any differences in Python between operating systems or is it really compatible with the majority of operating systems?   Obviously I don't know anything about Python,

Re: [Tutor] need some help with ascii hex

2005-08-18 Thread francois schnell
Hello, I'm not a Tutor but I found this wich could help you: Source: http://mail.python.org/pipermail/tutor/2003-March/021123.html To convert character data to integers, you can use the ord()function, and to convert a number to hex notation you can use thehex() function.Example:>>> data ="" "

Re: [Tutor] Linux app question

2005-08-18 Thread ZIYAD A. M. AL-BATLY
On Thu, 2005-08-18 at 18:10 +0100, Alan G wrote: > It might be /usr/bin/env... It is "/usr/bin/env". You could use "/usr/bin/python" instead under Linux (it might not work under other Unix like OSes). > Yes, in fact you dont really need to rename the file, its just a > nicety. > > All Unix scr

Re: [Tutor] deriving class from file to handle input line numbers?

2005-08-18 Thread Andreas Kostyrka
My try at this problem: # filecounter.py: #!/usr/bin/env python class CountedFile(file): def __init__(self, *args, **kw): self.linecount = 0 super(CountedFile, self).__init__(*args, **kw) def read(self, *args): data = super(CountedFile, self).read(*args) s

Re: [Tutor] Is there anyway to set how many numbers are used after the decimal in floating numbers?

2005-08-18 Thread Nathan Pinno
I want to use it for a currency exchange program. It's useful, then the user wouldn't have to round it himself/herself, and mistakes could be avoided. Nathan Pinno --- Early to bed, Early to rise, Makes a man healthy, wealthy, and wise.

Re: [Tutor] Is there anyway to set how many numbers are used after the decimal in floating numbers?

2005-08-18 Thread Bob Gailer
At 10:31 AM 8/18/2005, Nathan Pinno wrote: >Is there anyway to set how many numbers are used after the decimal in >floating numbers? It would be nice if the answer could be rounded to 2 >decimal spots, instead of the ten millionths spot. The simple answer is NO. Floating point numbers have a "fi

Re: [Tutor] Linux app question

2005-08-18 Thread Alan G
>>THe usual unix shebang trick will work just fine. >> >>call your install script 'install' and put >> >>#! /bin/env/python It might be /usr/bin/env... >> >>as the first line. It should then run directly with no problems. >>Assuming of course that Python is already installed on the web >>server!

[Tutor] Is there anyway to set how many numbers are used after the decimal in floating numbers?

2005-08-18 Thread Nathan Pinno
Hi all,   Is there anyway to set how many numbers are used after the decimal in floating numbers? It would be nice if the answer could be rounded to 2 decimal spots, instead of the ten millionths spot.   Thanks in advance, Nathan Pinno --

[Tutor] need some help with ascii hex

2005-08-18 Thread nephish
Hey there, i am using the serial module and trying to get some info over an RS232 port. Seems to be comming in ok, but when i print it out, its in ASCII instead of hex. is there a way to have python read serial in hex bytes instead of ASCII ? thanks. shawn ___

Re: [Tutor] Linux app question

2005-08-18 Thread Alberto Troiano
Hey Alan >From: "Alan G" <[EMAIL PROTECTED]> >To: "Alberto Troiano" <[EMAIL PROTECTED]>, >Subject: Re: [Tutor] Linux app question >Date: Thu, 18 Aug 2005 08:25:51 +0100 > >>1.- Is there any way that the script can be started when he mounts the >>CDROM with the command mount /mnt/cdrom? > >I don'

[Tutor] Need help with serial input

2005-08-18 Thread nephish
Hey there, i am using the serial module and trying to get some info over an RS232 port. Seems to be comming in ok, but when i print it out, its in ASCII instead of hex. is there a way to have python read serial in hex bytes instead of ASCII ? thanks. shawn ___

Re: [Tutor] i18n on Entry widgets

2005-08-18 Thread Kent Johnson
I got it working with a utf-8 query by adding an Accept-Charset header to the request. I used the 'Tamper Data' add-on to Firefox to view all the request headers being sent by the browser. I added all the same headers to the Python request and it worked. Then I took out the headers until I found

Re: [Tutor] Float Addition

2005-08-18 Thread Alan G
I'm not exactky sure what's causing the errant behaviour but it might help if we start off by simplifying the code a little. > for N in range( 2, len( DEF_CARRIER_TUP) ): >Dis_N = DistanceCalc( DEF_CARRIER_TUP[N], > DEF_CARRIER_TUP[N-1] ) >print ( "Distance = " + str(Dis_N) )

Re: [Tutor] Linux app question

2005-08-18 Thread Ewald Ertl
Hi Alberto Alberto Troiano wrote: > Hey tutorslong time don't see...*grin* > > I have a question, I've made a web page in PHP and its going to run under > Linux Red Hat 9.0 > > The page has scripts that has to be on a certain path off the system...I > have to make a CD to give the web page

Re: [Tutor] Linux app question

2005-08-18 Thread Alan G
> 1.- Is there any way that the script can be started when he mounts > the CDROM with the command mount /mnt/cdrom? I don't know of any way to autostart a CD program on mount in Linux. > 2.- Is there any way that the script could be started by typing > directly ./installer instead of python ins