Re: [Tutor] First Try 1.2

2006-02-22 Thread John Connors
G'day, Added a power ball option to the lotto program today. The program does way more then I ever intended when I started it so I'll try a new project. Maybe I'll come back to it when I try out Tkinter and try to give it a GUI. Anywayhere's my latest effort. import random # store the /h

Re: [Tutor] First Try 1.2

2006-02-22 Thread Kent Johnson
John Connors wrote: > import random > > # store the /home/mutt/lotto.txt in f > f = file('/home/mutt/lotto.txt','w') > # create or replace lotto.txt in my home directory > f.write('Here are your numbers:\n\n') > The comments don't really add anything to the program. Comments that restate exactl

[Tutor] Unable to take input as a module

2006-02-22 Thread Rakesh Mishra
hi I am trying to write a program, which ask for user input for a name then determines it wither that is module or not, if module then it will tell  all its attributes, methods, function etc my code: .. . import sys, types, string, inspect input= sys.argv[1]  print  inspect.ismodule

[Tutor] Repeating a routine

2006-02-22 Thread John Connors
G'day, With my only programming experience being C-64 Basic I'm finding that I struggle a bit understanding some of the concepts of Python, I wish I could block basic right out of my brain. One of the things I can't get a grasp of is how to repeat a routine many times. For example a simple d

Re: [Tutor] First Try 1.2

2006-02-22 Thread John Connors
G'day Kent, Thanks for the input. >The comments don't really add anything to the program. Comments that >restate exactly what the code is doing are not that helpful. The code >should be clear by itself. As a beginner they may seem like a helpful >crutch but you will get better at reading the cod

Re: [Tutor] Unable to take input as a module

2006-02-22 Thread Karl Pflästerer
On 22 Feb 2006, [EMAIL PROTECTED] wrote: > my code: > .. > . > import sys, types, string, inspect > > input= sys.argv[1] > print inspect.ismodule(input) > > > here it always give false. as what ever input i take it is string . > > my problem is i am not able to take inp

[Tutor] twisted

2006-02-22 Thread Burge Kurt
Hi,   I could not get a reply from twisted-web mailing list so I want to try my chance here..   I want to create an httpserver behind a twisted-server. Actually I have got a twisted server which is running(i did not code it!) and also some samples of simple httpserver codes but don't know how to in

Re: [Tutor] Repeating a routine

2006-02-22 Thread Brian van den Broek
John Connors said unto the world upon 22/02/06 05:43 AM: > G'day, > > With my only programming experience being C-64 Basic I'm finding that I > struggle a bit understanding some of the concepts of Python, I wish I > could block basic right out of my brain. > > One of the things I can't get a gr

Re: [Tutor] Python & XEmacs

2006-02-22 Thread Hoffmann
--- w chun <[EMAIL PROTECTED]> wrote: > > Could anyone, please, suggest a "tutorial" about > > Python Mode for XEmacs? I would like to use > XEmacs, > > but unfortunately, I didn't find any good > > documentation about using it for programming in > Python > > > i don't know if there really is a

Re: [Tutor] Unable to take input as a module

2006-02-22 Thread Ewald Ertl
Hello rakesh, Perhaps this could take you further: [GCC 3.3.2] on sunos5 Type "help", "copyright", "credits" or "license" for more information. >>> a=__import__("inspect") >>> a >>> a.ismodule(a) True HTH Ewald Rakesh Mishra wrote: > hi > > I am trying to write a program, which ask for user

Re: [Tutor] Python & XEmacs

2006-02-22 Thread Brian van den Broek
Hoffmann said unto the world upon 22/02/06 09:26 AM: > --- w chun <[EMAIL PROTECTED]> wrote: > > >>>Could anyone, please, suggest a "tutorial" about >>>Python Mode for XEmacs? I would like to use >>are you trying to learn Python, learn (X)Emacs, >>both, or neither? >> >>-- wesley >> > > > He

[Tutor] Translator

2006-02-22 Thread ryan luna
Well see, its not a complex language at all, Here is basicly what it is a = ba. b = ga. somthing like that, my only problem is getting it to translate muiltpul letters at a time say the user types a it prints ba like it should, but if the user types in ab it prints ab not baga

Re: [Tutor] Translator

2006-02-22 Thread Kent Johnson
ryan luna wrote: > Well see, its not a complex language at all, > Here is basicly what it is > a = ba. > b = ga. > somthing like that, my only problem is getting it to > translate muiltpul letters at a time > say the user types a > it prints > ba like it should, > but if the user types in ab > it

[Tutor] ftplib error

2006-02-22 Thread benmarkwell
I'm trying to write a backup script to put files on a server. --This is how I have begun: from ftplib import FTP f = open(r'g:\dev\python\exercises\aaa.py', 'r')fname = r'g:\dev\python\exercises\aaa.py' ftp = FTP('ftp..com') ftp.login()ftp.storlines ('STOR ' + fname, f)ftp.retrlines('LIST') f.

Re: [Tutor] Repeating a routine

2006-02-22 Thread Pawel Kraszewski
Dnia środa, 22 lutego 2006 12:43, John Connors napisał: > I know goto and gosub are evil, bad habits but I'm starting to miss them. You SHOULD miss them. GOSUB is called a function call in Python (you call a function by its name, rather than by its starting line number) Someone misinformed you

Re: [Tutor] ftplib error

2006-02-22 Thread Kent Johnson
[EMAIL PROTECTED] wrote: > I'm trying to write a backup script to put files on a server. > > --This is how I have begun: > > > from ftplib import FTP > > f = open(r'g:\dev\python\exercises\aaa.py', 'r') > fname = r'g:\dev\python\exercises\aaa.py' > > ftp = FTP('ftp..com

Re: [Tutor] Repeating a routine

2006-02-22 Thread Brian Gustin
yeah GOTO , in basic (I used to write software in Commodore BASIC myself) is similar to a for or while loop - In BASIC, you would write a program, *including* line numbers thus: 10 a=32 20 b="hello" 30 print a 40 print b 50 a=a-1 60 if a > 0 goto 20 70 end (It's probably not 100% syntactically

[Tutor] Locking a file in linux with Python

2006-02-22 Thread Pat Martin
Hello,I am trying to find on the web how to lock a file with python in Linux. I am trying to process a group of files that are continually being written to and when I am working on one file I would like to be able to lock it. Can anyone point me in the right direction for that. Thanks-- Pat Martin

Re: [Tutor] Interpackage access help

2006-02-22 Thread Francesco A. Queirolo
>Francesco A. Queirolo wrote: >> Sorry about the double post but the first one was sent before I was >> completed with my question. >> >> I have the following directory structure on Windows XP running python >> 2.4.2 final: >> >> JavaInheritancePoly\ >>HierarchicalInheritancePol

Re: [Tutor] Locking a file in linux with Python

2006-02-22 Thread Danny Yoo
On Wed, 22 Feb 2006, Pat Martin wrote: > I am trying to find on the web how to lock a file with python in Linux. > I am trying to process a group of files that are continually being > written to and when I am working on one file I would like to be able to > lock it. Can anyone point me in the ri

[Tutor] Does casting exist in Python?

2006-02-22 Thread Edgar Antonio Rodriguez Velazco
Does it?Thanks,-- Edgar A. Rodriguez V. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python & XEmacs

2006-02-22 Thread Terry Carroll
On Wed, 22 Feb 2006, Brian van den Broek wrote: > on one read of "neither" it is marking the possibility that you know > Python, you know (X)Emacs and you merely need to learn how to make the > two work together. (Thus, neither is such that you are trying to learn > it.) > > Bet a 1$ that read

Re: [Tutor] Locking a file in linux with Python

2006-02-22 Thread Pat Martin
> I am trying to find on the web how to lock a file with python in Linux.> I am trying to process a group of files that are continually being > written to and when I am working on one file I would like to be able to> lock it. Can anyone point me in the right direction for that.Hi Pat,Take a look at

Re: [Tutor] Does casting exist in Python?

2006-02-22 Thread Sean Perry
Edgar Antonio Rodriguez Velazco wrote: > Does it? > Thanks, > not exactly. new_list = list(my_tuple) In general Python works without having to nudge the type system. For char -> int style conversions there is a builtin function called 'ord'. ___ Tuto

Re: [Tutor] Locking a file in linux with Python

2006-02-22 Thread Pat Martin
On 2/22/06, Pat Martin <[EMAIL PROTECTED]> wrote: > I am trying to find on the web how to lock a file with python in Linux. > I am trying to process a group of files that are continually being > written to and when I am working on one file I would like to be able to> lock it. Can anyone point me in

Re: [Tutor] Does casting exist in Python?

2006-02-22 Thread Kent Johnson
Edgar Antonio Rodriguez Velazco wrote: > Does it? No, because variables are untyped in Python there is no need for casting. In Python values have types, variables are just names. You just use the value and if it has the correct type it will work. There are some functions that transform values f

Re: [Tutor] Locking a file in linux with Python

2006-02-22 Thread Danny Yoo
On Wed, 22 Feb 2006, Pat Martin wrote: > I had actually looked at that site, but when I do the commands > > testfile = open('testlock', 'a+') > fcntl.flock(mboxfile.fileno(), fcntl.LOCK_EX) > > in the interpreter and then try to access the file in another terminal > (I leave the interpreter open

Re: [Tutor] Locking a file in linux with Python

2006-02-22 Thread Adam
You could try setting up a seperate user and then changing permissions on the file so that only that user can access it then change it back when you've finished. ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Translator

2006-02-22 Thread Adam
If you want to do genuine translation, like English to French or something, then, well, ask someone who works at Google :-)Guido? ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python & XEmacs

2006-02-22 Thread Brian van den Broek
Terry Carroll said unto the world upon 22/02/06 01:04 PM: > On Wed, 22 Feb 2006, Brian van den Broek wrote: > > >>on one read of "neither" it is marking the possibility that you know >>Python, you know (X)Emacs and you merely need to learn how to make the >>two work together. (Thus, neither is

Re: [Tutor] Repeating a routine

2006-02-22 Thread John Connors
G'day, I think my peanut sized brain is starting to understand how to do this. I tried with a simple dice game where 4 dice are rolled, if the total of the last 2 dice rolled is 6 you win. It's kinda pointless using 4 dice rolls when only 2 are needed but I wanted to prove to myself I could cal

Re: [Tutor] Repeating a routine

2006-02-22 Thread Sean Perry
Jumping to the middle of a book or movie will lead to similar confusion. Give a look at Dive Into Python. Available as either a book or online. http://www.diveintopython.org/ ___ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinf

Re: [Tutor] Repeating a routine

2006-02-22 Thread John Connors
G'day Sean, >Jumping to the middle of a book or movie will lead to similar confusion. > >Give a look at Dive Into Python. Available as either a book or online. I have it and it's a great book, and I have worked my way through a lot of it unfortunately my brain can't take something in unless I do

Re: [Tutor] Does casting exist in Python?

2006-02-22 Thread Edgar Antonio Rodriguez Velazco
> No, because variables are untyped in Python there is no need for> casting. In Python values have types, variables are just names. You just> use the value and if it has the correct type it will work.> > There are some functions that transform values from one type to another.> These are not really

Re: [Tutor] Repeating a routine

2006-02-22 Thread Brian van den Broek
John Connors said unto the world upon 22/02/06 07:59 PM: > G'day, > > I think my peanut sized brain is starting to understand how to do this. Glad you're making progress :-) It's normal it takes a while to learn to adjust your thinking to a rigid and precise system. I've made some pretty big