Re: [Tutor] Corrupt files (fwd)

2005-08-02 Thread ZIYAD A. M. AL-BATLY
On Tue, 2005-08-02 at 13:22 -0700, Danny Yoo wrote: > > -- Forwarded message -- > Date: Tue, 2 Aug 2005 22:12:34 +0200 (CEST) > From: "[iso-8859-1] yvind" <[EMAIL PROTECTED]> > To: Danny Yoo <[EMAIL PROTECTED]> > Subject: Re: [Tutor] Corrupt files > > Hello and thank you. > > I d

[Tutor] I need advice about which way to go.

2005-08-02 Thread Nathan Pinno
Hi all,   I am writing a poker game and a blackjack game. I was wondering which way would be Python smart and work properly. I am trying to figure out whether or not to use t(n) as a card indicator, when n = randomly drawn number. I could go that way, or code it as t1, t2, t3, etc. Which way

Re: [Tutor] Question about resetting values

2005-08-02 Thread Nathan Pinno
Never mind all. I was just being stupid as usual. I thought that there might be a Python command for resetting and wanted to find out if that was the case. - Original Message - From: "Alan G" <[EMAIL PROTECTED]> To: "Nathan Pinno" <[EMAIL PROTECTED]>; "Tutor mailing list" Sent: Tuesday

Re: [Tutor] I need advice.

2005-08-02 Thread Don Parris
On Tue, 2 Aug 2005 10:12:28 +0100 "Alan G" <[EMAIL PROTECTED]> wrote: > > > I forgot to tell that I use Python 2.2.3. When I first got Python, I > > got > > 2.4.1, but it refused to run the second time. So I went and got > > 2.2.3. Your answer would make sense if I had 2.4.1, but I don't. > >

Re: [Tutor] fourier transform

2005-08-02 Thread Jeff Peery
Hi Christian,   sorry for the lack of detail. how about I use a sine wave because I know what the output should look like - amplitude of one at frequency equal to the frequency of the sine wave.   one period of a sin wave that cycles at one hertz: period = 1 input = sin(arange(0,64)*3.14159*2/64.

Re: [Tutor] print a line in IDLE as bold, italics or a color

2005-08-02 Thread Victor Reijs
Hello Danny, Danny Yoo wrote: >>This is in a seperate text box, but I want to have the colors >>(bold/italics) in the default IDLE window. > > This will probably be more difficult. I don't believe IDLE itself allows > a user's program to set its own fonts and colors within the running IDLE > win

Re: [Tutor] print a line in IDLE as bold, italics or a color

2005-08-02 Thread Danny Yoo
On Tue, 2 Aug 2005, Victor Reijs wrote: > This is in a seperate text box, but I want to have the colors > (bold/italics) in the default IDLE window. [Note: please use Reply-to-all] This will probably be more difficult. I don't believe IDLE itself allows a user's program to set its own fonts a

[Tutor] substituting empty line with stuff

2005-08-02 Thread Srinivas Iyyer
Hello group: I have a file (3339203 lines) that looks like this: (col:1)(col:2) (col:3) AD134KL X X X X X X AD144KL Y Y Y Y Now I have to fill the rows in co

Re: [Tutor] print a line in IDLE as bold, italics or a color

2005-08-02 Thread Danny Yoo
On Tue, 2 Aug 2005, Victor Reijs wrote: > I am trying to simply(?) print some text in a print statement as bold > (or itlaics or an certain color). How do I do this in python? Browsing > the web gives we all kind of soluation, but non seem to work (a lot are > related when printing on the web).

Re: [Tutor] Deleting an entry from a dictionary

2005-08-02 Thread Adam Bark
meals.pop(key) will do it. Example: >>> meals = {} >>> meals['breakfast'] = 'slimfast' >>> meals['lunch'] = 'slimfast' >>> meals['dinner'] = 'something sensible' >>> meals {'lunch': 'slimfast', 'breakfast': 'slimfast', 'dinner': 'something sensible'} >>> meals.pop("breakfast") 'slimfast' >>> meals

Re: [Tutor] Deleting an entry from a dictionary

2005-08-02 Thread Danny Yoo
On Tue, 2 Aug 2005, Greg Lindstrom wrote: > This must be simple, but for the life of me I can't figure out how to > delete an entry from a dictionary. For example, > > meals = {} > meals['breakfast'] = 'slimfast' > meals['lunch'] = 'slimfast' > meals['dinner'] = 'something sensible' > > How do

[Tutor] Deleting an entry from a dictionary

2005-08-02 Thread Greg Lindstrom
Hello- This must be simple, but for the life of me I can't figure out how to delete an entry from a dictionary. For example, meals = {} meals['breakfast'] = 'slimfast' meals['lunch'] = 'slimfast' meals['dinner'] = 'something sensible' How do I eliminate 'lunch' from the dictionary so that I onl

Re: [Tutor] Corrupt files

2005-08-02 Thread Roger Merchberger
Rumor has it that geon may have mentioned these words: >Øyvind napsal(a): > > >Hello. > > > >I have created a program that automatically downloads some files I need. > >It can be .zip, .jpg, .mpg or .txt. However, a lot of the time urlretrieve > >downloads the file, gives no error, but the download

Re: [Tutor] Corrupt files

2005-08-02 Thread Alan G
>>I have created a program that automatically downloads some files I >>need. >>It can be .zip, .jpg, .mpg or .txt. However, a lot of the time >>urlretrieve >>downloads the file, gives no error, but the downloaded file is >>corrupted. >>I use a simple check for the size of the file. If it is way

Re: [Tutor] Question about resetting values

2005-08-02 Thread Alan G
> 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://www.freenetpages.co.uk/hp/alan.gauld __

Re: [Tutor] Corrupt files (fwd)

2005-08-02 Thread Danny Yoo
-- Forwarded message -- Date: Tue, 2 Aug 2005 22:12:34 +0200 (CEST) From: "[iso-8859-1] �yvind" <[EMAIL PROTECTED]> To: Danny Yoo <[EMAIL PROTECTED]> Subject: Re: [Tutor] Corrupt files Hello and thank you. I don't really think that will help. The files are mostly smaller ones of

[Tutor] print a line in IDLE as bold, italics or a color

2005-08-02 Thread Victor Reijs
Hello all of you, I am trying to simply(?) print some text in a print statement as bold (or itlaics or an certain color). How do I do this in python? Browsing the web gives we all kind of soluation, but non seem to work (a lot are related when printing on the web). Say I want to print the text

Re: [Tutor] I need advice.

2005-08-02 Thread Nathan Pinno
I am now using Python 2.4.1, but decided to abandon it. It got too confusing too fast. I'm better off writing simple games and apps for now. - Original Message - From: "Nathan Pinno" <[EMAIL PROTECTED]> To: "Danny Yoo" <[EMAIL PROTECTED]> Cc: "Tutor mailing list" Sent: Tuesday, August 02

[Tutor] For Damien

2005-08-02 Thread Enrique Acosta Figueredo
os.path.isdir: > http://python.org/doc/2.4.1/lib/module-os.path.html#l2h-1739 > > HTH, > Wolfram > > > > -- > > Message: 7 > Date: Tue, 02 Aug 2005 18:00:07 +0200 > From: Damien <[EMAIL PROTECTED]> > Subject: Re: [Tutor] Directory or F

Re: [Tutor] Corrupt files

2005-08-02 Thread geon
Øyvind napsal(a): >Hello. > >I have created a program that automatically downloads some files I need. >It can be .zip, .jpg, .mpg or .txt. However, a lot of the time urlretrieve >downloads the file, gives no error, but the downloaded file is corrupted. >I use a simple check for the size of the fil

Re: [Tutor] Corrupt files

2005-08-02 Thread Danny Yoo
On Tue, 2 Aug 2005, [iso-8859-1] �yvind wrote: > Is there some function/modulte that checks a files integrity wheter or > not the file is corrupt or not? Hello! A general technique that people have used before is to provide file "checksums" of large files. These checksums can be used to verif

Re: [Tutor] JBUS and Python which way

2005-08-02 Thread Miguel Lopes
pyserial provides serial communication but I think I require an interface that would abstract/simplify the JBUS/MODBUS protocol. Thanks Danny and Alan for all the help. Will check out comp.lang.python for advice. Best Miguel --- Chegou o Clix ADSL até 16 Megas In

[Tutor] Question about resetting values

2005-08-02 Thread Nathan Pinno
I am writing a Blackjack program, and was wondering how to reset the values to zero, e.g. cash = 0?   Thanks, Nathan Pinno,Crew, Camrose McDonalds and owner/operator of Woffee BEGIN:VCARD VERSION:2.1 N:Pinno;Nathan;Paul;Mr. FN:Pinno, Nathan Paul ORG:Woffee;Executive TITLE:Owner/operator TEL;CE

Re: [Tutor] time.sleep() error

2005-08-02 Thread geon
geon napsal(a): sunny sunny napsal(a): Hi all, I am using time.sleep to stop my program execution for some time. I have imported time and am able to use it sucessfully in the main program. However if I use it in any function I get the following error: the time.sleep(1) command

Re: [Tutor] (no subject)

2005-08-02 Thread Kristian Rink
Greg Janczak schrieb: > This is a totally unrelated question but does anyone know a good free iso > image burner? Well, what don't you like about cdrecord? Otherwise, specifying which operating system you're intending to use this on would be quite a good idea. ;) Cheers, Kris -- "Sei Du selbst

[Tutor] (no subject)

2005-08-02 Thread Greg Janczak
This is a totally unrelated question but does anyone know a good free iso image burner? greg _ Express yourself instantly with MSN Messenger! Download today - it's FREE! http://messenger.msn.click-url.com/go/onm00200471ave/direct/0

Re: [Tutor] I need advice.

2005-08-02 Thread Nathan Pinno
I think I'll leave this one for someone else. I got too confused too quick. - Original Message - From: "Alan G" <[EMAIL PROTECTED]> To: "Nathan Pinno" <[EMAIL PROTECTED]>; "Tutor mailing list" Sent: Tuesday, August 02, 2005 1:47 AM Subject: Re: [Tutor] I need advice. >> I want to write

Re: [Tutor] fourier transform

2005-08-02 Thread Christian Meesters
Hi Pawel Kraszewski wrote: > 4. The answer is symmetrical - usually you take only half of it. I > don't > remember the exact difference between the halves, but you may find it > in any > article on FFT. The real part is identical the imaginary part has the opposite sign ("same amplitude, oppos

Re: [Tutor] time.sleep() error

2005-08-02 Thread geon
sunny sunny napsal(a): >Hi all, > >I am using time.sleep to stop my program execution for some time. I >have imported time and am able to use it sucessfully in the main >program. > >However if I use it in any function I get the following error: > >the time.sleep(1) command generates this error : >

Re: [Tutor] time.sleep() error

2005-08-02 Thread sunny sunny
Some additional information: I am calling this function from a thread and I get the error. However if I call the function from the main program it works fine. I am using thread.start_new_thread() to start the thread. Thanks. Santosh. On 8/2/05, sunny sunny <[EMAIL PROTECTED]> wrote: > Hi all

Re: [Tutor] time.sleep() error

2005-08-02 Thread Kent Johnson
sunny sunny wrote: > Hi all, > > I am using time.sleep to stop my program execution for some time. I > have imported time and am able to use it sucessfully in the main > program. > > However if I use it in any function I get the following error: > > the time.sleep(1) command generates this error

[Tutor] time.sleep() error

2005-08-02 Thread sunny sunny
Hi all, I am using time.sleep to stop my program execution for some time. I have imported time and am able to use it sucessfully in the main program. However if I use it in any function I get the following error: the time.sleep(1) command generates this error : TypeError : 'int' object is not ca

Re: [Tutor] Directory or File ?

2005-08-02 Thread Damien
Ok, sorry. In the future, I will look more closely the module before sending my question. Thanks. Kent Johnson a écrit : Damien wrote: Hi all, I want to know if a file is a directory or a simple file. Look at os.path.isdir() Kent I have done a little ugly sc

Re: [Tutor] Directory or File ?

2005-08-02 Thread Wolfram Kraus
Damien wrote: > Hi all, > I want to know if a file is a directory or a simple file. > I have done a little ugly script : > # i is my filename, os is imported > old = os.getcwd() > try: > chdir(i) > is_dir = True > except: > is_dir = False > os.chdir(old) > return is_dir > > But maybe t

Re: [Tutor] Directory or File ?

2005-08-02 Thread Kent Johnson
Damien wrote: > Hi all, > I want to know if a file is a directory or a simple file. Look at os.path.isdir() Kent > I have done a little ugly script : > # i is my filename, os is imported > old = os.getcwd() > try: > chdir(i) > is_dir = True > except: > is_dir = False > os.chdir(old)

[Tutor] Directory or File ?

2005-08-02 Thread Damien
Hi all, I want to know if a file is a directory or a simple file. I have done a little ugly script : # i is my filename, os is imported old = os.getcwd() try: chdir(i) is_dir = True except: is_dir = False os.chdir(old) return is_dir But maybe there is a better way ? If you know a bette

Re: [Tutor] Color text in Text widget

2005-08-02 Thread sunny sunny
Thanks. Its works very well. Santosh. On 8/1/05, Jorge Louis de Castro <[EMAIL PROTECTED]> wrote: > I found a way to do it but I'm not sure it is the cleanest. Maybe someone > else on this list can offer a better solution. > > I use the text's configuration to define tags that I apply to sections

[Tutor] Corrupt files

2005-08-02 Thread Øyvind
Hello. I have created a program that automatically downloads some files I need. It can be .zip, .jpg, .mpg or .txt. However, a lot of the time urlretrieve downloads the file, gives no error, but the downloaded file is corrupted. I use a simple check for the size of the file. If it is way too small

Re: [Tutor] terminology question

2005-08-02 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > Quoting Dick Moores <[EMAIL PROTECTED]>: > > >>Why are list comprehensions called that? > > > Because that's what they're called in Haskell, I guess.. > > It's historical, based on the term "set comprehension" from mathematics, also > known as "set builder notation":

Re: [Tutor] mailman

2005-08-02 Thread Damien
Mohammad Moghimi a écrit : [...] checking that Python has a working distutils... configure: error: * Distutils is not available or is incomplete for /usr/bin/python * If you installed Python from RPM (or other package manager) * be sure to install the -devel package, or install P

Re: [Tutor] QUESTION

2005-08-02 Thread Alan G
Hi Jane, > I'd like to know what kind of Python I can download. I've tried but > in vain! > My computer is windows xp servixe pack 1, version 2002. There are two main possibilities, either the generuc Python designed for any computer or the ActiveSTate vesion witch is the generic version with

Re: [Tutor] I need advice.

2005-08-02 Thread Alan G
> I forgot to tell that I use Python 2.2.3. When I first got Python, I > got > 2.4.1, but it refused to run the second time. So I went and got > 2.2.3. Your answer would make sense if I had 2.4.1, but I don't. Version 2.3 should work and has the datetime stuff I think - just checked and it does

Re: [Tutor] I need advice.

2005-08-02 Thread Alan G
> I want to write a program that will convert time in any other > time zone to my time zone. This is a deceptively complex task. There are around 40 timezones varying by anything from 15 minutes to 2 hours. And some places change timezone throughout the year. Others have multiple daylight savi

Re: [Tutor] I've run into a jam on the exercise on file I/O

2005-08-02 Thread Alan G
> What if I were to use ID's for the students and use the ID's as the > sequence > index, and link the students and their grades to the IDs? Its not necessary for what you are doing but it's how you'd normally do it in a relational database, so if you ever needed to turn your file based progra

Re: [Tutor] Question about BASIC and Python

2005-08-02 Thread Alan G
> I had a co-worker say to me at work that Python was related > to or based upon BASIC. Is this true, and if not, how can I > tell my friend why they are similar? Both Python and BASIC are interpreted languages intended to be used (amongst other things) to learn how to program. There the simil

Re: [Tutor] Question

2005-08-02 Thread Alan G
> Just curious to wonder if Python can be used to write a > program to check an HTTP mail server for mail, Yes, you would probably use the urllib module for that. > and check more than one server, Yes that would be a fairly typical use for Python as a web client. > even if they are using di