Re: [Tutor] run command

2009-09-04 Thread Eric Dorsey
Make sure you are in the same directory as your hello.py, then run the interpreter/shell Try this: >>>import hello then you can do things like: >>>dir(hello) and >>>help(hello) I'm not sure if that's what you were asking, but "import" is how you .. import. HTH. On Fri, Sep 4, 2009 at 5:31 P

Re: [Tutor] (no subject)

2009-09-04 Thread Felix Santiago
On Sep 4, 2009, at 8:31 PM, kb1...@aim.com wrote: I know, I'm a total noob (started yester day) But when I enter this code: x = 1 if x>0: a = raw_input ("Type something in...I will echo it:") print a x=x+1 it does not loop..am I missing something here? In your example the if statem

Re: [Tutor] (no subject)

2009-09-04 Thread bob gailer
kb1...@aim.com wrote: I know, I'm a total noob (started yester day) But when I enter this code: x = 1 if x>0: a = raw_input ("Type something in...I will echo it:") print a x=x+1 it does not loop..am I missing something here? You are missing a looping statement. In Python they are fo

[Tutor] (no subject)

2009-09-04 Thread kb1pkl
I know, I'm a total noob (started yester day) But when I enter this code: x = 1 if x>0: ??? a = raw_input ("Type something in...I will echo it:") ??? print a ??? x=x+1 it does not loop..am I missing something here? ___ Tutor maillist - Tutor@python.org

Re: [Tutor] Help deciding between python and ruby

2009-09-04 Thread David Kim
On Fri, 2009-09-04 at 06:18 -0700, dan06 wrote: > I'd like to learn a programming language - and I need help deciding between > python and ruby. I'm interesting in learning what are the difference, both > objective and subjective, between the two languages. I know this is a python > mailing list, s

Re: [Tutor] Help deciding between python and ruby

2009-09-04 Thread Dirk Wangsadirdja
Hi, I've never learned ruby, but from what I read, ruby is a pure OOP language, and if you are going to do a lot of web creation, then ruby on rails is a good one. What I can advice is, if you choose to stick with python, perhaps you shouldn't use python 3.x, but use python 2.5 (from what I

[Tutor] run command

2009-09-04 Thread upasara wulung
hello, Wish you would not mind a really beginner question. I am trying to use 'run' command, but didnot success yet. How I did it: (1) In a certain working folder, I produced simple python file, for an example, hello.py, which is free of error. (2) I called python from the same working folder usi

Re: [Tutor] Help deciding between python and ruby

2009-09-04 Thread bob gailer
dan06 wrote: I'd like to learn a programming language - and I need help deciding between python and ruby. I'm interesting in learning what are the difference, both objective and subjective, between the two languages. I know this is a python mailing list, so knowledge/experience with ruby may be l

[Tutor] (no subject)

2009-09-04 Thread kb1pkl
On Fri, 2009-09-04 at 06:18 -0700, dan06 wrote: > I'd like to learn a programming language - and I need help deciding between > python and ruby. I'm interesting in learning what are the difference, both > objective and subjective, between the two languages. I know this is a python > mailing list,

Re: [Tutor] Simple regex replacement match (converting from Perl)

2009-09-04 Thread Jerry Hill
On Fri, Sep 4, 2009 at 1:34 PM, GoodPotatoes wrote: > I simply want to remark out all non-word characters read from a line. > > Line: > Q*bert says "#...@!$%  " > > in Perl > #match each non-word character, add "\" before it, globally. > > $_=s/(\W)/\\$1/g; > > output: > Q\*bert\ says\ \"\...@\!\$\

Re: [Tutor] Having trouble with a dictionary of lists

2009-09-04 Thread William Witteman
On Fri, Sep 04, 2009 at 09:54:20AM -0700, Emile van Sebille wrote: >On 9/4/2009 9:09 AM William Witteman said... >>On Thu, Sep 03, 2009 at 11:26:35AM -0700, Emile van Sebille wrote: >> >>Thanks to Emile for pointing out the error. There were several other >>errors - initiating the counter in the l

Re: [Tutor] Help deciding between python and ruby

2009-09-04 Thread Alan Gauld
"dan06" wrote I'd like to learn a programming language - and I need help deciding between python and ruby. I'm interesting in learning what are the difference, There is lots of info on their web sites. asking a question like this is troll baiting in a big way, any debate about languages wil

[Tutor] Simple regex replacement match (converting from Perl)

2009-09-04 Thread GoodPotatoes
I simply want to remark out all non-word characters read from a line. Line: Q*bert says "#...@!$% " in Perl #match each non-word character, add "\" before it, globally. $_=s/(\W)/\\$1/g; output: Q\*bert\ says\ \"\...@\!\$\%\ \ \" #perfect! Is there something simple like this in python? I

Re: [Tutor] Help deciding between python and ruby

2009-09-04 Thread Robert Berman
I think you will get at the least a slight bias toward Python. However, I think you should do your own research and reach your own conclusions. Simply to get you started I put the following into Google: 'Python or Ruby: Which to learn' and got more than 1M hits. Best of luck. Robert On Fri, 200

Re: [Tutor] Having trouble with a dictionary of lists

2009-09-04 Thread Emile van Sebille
On 9/4/2009 9:09 AM William Witteman said... On Thu, Sep 03, 2009 at 11:26:35AM -0700, Emile van Sebille wrote: Thanks to Emile for pointing out the error. There were several other errors - initiating the counter in the loop (d'oh!), premature sorting of the dictionary by keys, not providing an

Re: [Tutor] Help deciding between python and ruby

2009-09-04 Thread Mac Ryan
On Fri, 2009-09-04 at 06:18 -0700, dan06 wrote: > I'd like to learn a programming language - and I need help deciding between > python and ruby. I'm interesting in learning what are the difference, both > objective and subjective, between the two languages. I know this is a python > mailing list, s

Re: [Tutor] Having trouble with a dictionary of lists

2009-09-04 Thread William Witteman
On Thu, Sep 03, 2009 at 11:26:35AM -0700, Emile van Sebille wrote: Thanks to Emile for pointing out the error. There were several other errors - initiating the counter in the loop (d'oh!), premature sorting of the dictionary by keys, not providing an index row for the output file, not returning a

Re: [Tutor] Help deciding between python and ruby

2009-09-04 Thread Luke Paireepinart
A primary draw of Ruby has always been Ruby on Rails, a web framework. Python has a lot of really good web frameworks now, though, so this is less of a concern.When I tried to learn Ruby, the docs were terrible. The primary developers are Japanese, and the translations were very poor and incompl

Re: [Tutor] Input validation

2009-09-04 Thread Rich Lovely
2009/9/3 Albert-Jan Roskam : > Hi, > > I'm wondering what is the most common method of input validation. See the > example below. > -Is the code below the most common/recognizable way something like this is > done? > -Which of the options #1 and #2 is the preferred method? Option #2 looks less >

[Tutor] Help deciding between python and ruby

2009-09-04 Thread dan06
I'd like to learn a programming language - and I need help deciding between python and ruby. I'm interesting in learning what are the difference, both objective and subjective, between the two languages. I know this is a python mailing list, so knowledge/experience with ruby may be limited - in wh

Re: [Tutor] Processing a string of bytes

2009-09-04 Thread Kent Johnson
On Thu, Sep 3, 2009 at 3:17 PM, David Perlman wrote: > So, in summary, I would be interested in either of two things: > 1. advice on how to do arithmetic on the string of bytes without converting > it to a list of ints first, or > 2. advice on how to convert it to a list of ints, and then back to

Re: [Tutor] how to read and transmit/send only section of the image (sub-image)

2009-09-04 Thread Kent Johnson
On Thu, Sep 3, 2009 at 6:01 PM, Jojo Mwebaze wrote: > thanks guys, > Currently i am using pyfits, a bit slow cause loads the file in memory, > creates a subimage and then saves the file then transmits > the file over the network! My idea is,  if there is a way of creating a file > pointer to the l

Re: [Tutor] How to iterate through unicode string.

2009-09-04 Thread Dirk Wangsadirdja
Hi allen (and perhaps this goes also for others), just a suggestion, maybe when we post a problem, we should also mention the python version that we use. Sometimes, different version of python would give different results. I tried it with Python 3.1 (python 3.x uses unicode for string) and P

Re: [Tutor] How to iterate through unicode string.

2009-09-04 Thread zhang allen
Thank you very much. :) it works now. 2009/9/4 Christian Witts > If it's not you can put an encoding line @ the top of your script like > # -*- encoding: utf-8 -*- > > David Stanek wrote: > >> Is the encoding of your file set? >> >> >> On 9/4/09, zhang allen wrote: >> >> >>> Hi Christian, >>>

Re: [Tutor] How to iterate through unicode string.

2009-09-04 Thread Christian Witts
If it's not you can put an encoding line @ the top of your script like # -*- encoding: utf-8 -*- David Stanek wrote: Is the encoding of your file set? On 9/4/09, zhang allen wrote: Hi Christian, Thanks for your tip. But it seems to me still not working again. i wirte this python code k

Re: [Tutor] How to iterate through unicode string.

2009-09-04 Thread David Stanek
Is the encoding of your file set? On 9/4/09, zhang allen wrote: > Hi Christian, > > Thanks for your tip. > > But it seems to me still not working again. > > i wirte this python code > > k = [] > s = u'Büro' > for c in s: > k.append(c) > print k > > k=[u'B', u'\xa8', u'\xb9', u'r', u'o'] > >

Re: [Tutor] How to iterate through unicode string.

2009-09-04 Thread zhang allen
Hi Christian, Thanks for your tip. But it seems to me still not working again. i wirte this python code k = [] s = u'Büro' for c in s: k.append(c) print k k=[u'B', u'\xa8', u'\xb9', u'r', u'o'] i still have 5 different chars. 2009/9/4 Christian Witts > zhang allen wrote: > >> Hi A

Re: [Tutor] How to iterate through unicode string.

2009-09-04 Thread zhang allen
Hi Andre, i tried this. s = u'Büro' print len(s) prints 5. it seems not working : ) 2009/9/4 Andre Engels > On Fri, Sep 4, 2009 at 2:20 PM, zhang allen wrote: > > Hi All, > > > > Say i have unicode string Büro. > > i want to iterate this string . > > > > i write this python code which doesn

Re: [Tutor] How to iterate through unicode string.

2009-09-04 Thread Christian Witts
zhang allen wrote: Hi All, Say i have unicode string * Büro*. i want to iterate this string . i write this python code which doesn't work. s ='Büro' for ch in s: print ch it seems *Büro* has 5 chars. *ü *consists of 2 bytes. so does someone has any ideas? how to iterate this string, so i ca

Re: [Tutor] How to iterate through unicode string.

2009-09-04 Thread Andre Engels
On Fri, Sep 4, 2009 at 2:20 PM, zhang allen wrote: > Hi All, > > Say i have unicode string  Büro. > i want to iterate this string . > > i write this python code which doesn't work. > > s ='Büro' > for ch in s: >     print ch > > it seems Büro has 5 chars. ü consists of 2 bytes. > > so does someone

[Tutor] How to iterate through unicode string.

2009-09-04 Thread zhang allen
Hi All, Say i have unicode string * Büro*. i want to iterate this string . i write this python code which doesn't work. s ='Büro' for ch in s: print ch it seems *Büro* has 5 chars. *ü *consists of 2 bytes. so does someone has any ideas? how to iterate this string, so i can hava 4 chars, l