Re: [Tutor] referring to subfolders

2009-01-17 Thread Kent Johnson
On Sat, Jan 17, 2009 at 12:20 AM, Che M  wrote:

> import os.path
> self.currentdir = os.curdir
> self.mysubfolder = os.path.join(self.currentdir, "subfolder")
> path = self.mysubfolder + '/myfile.py'
>
> Is this really the only way to do it,and so I have to import
> os.path each time I have a case where I refer to a subdirectory?

The advantage of os.path.join() (if you use it for all joins) is that
it is portable, it will use the appropriate path separator for the
platform it is running on. These days that is not such a big deal,
perhaps, as Mac OSX, Windows and Linux all accept / as a path
separator.

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Translating FORTRAN (77?) to Python?

2009-01-17 Thread bob gailer

Wayne Watson wrote:
I may have a need down the line to convert a large number of lines of 
FORTRAN code to Python. Is there a good translator available to do this?


I guess from the responses and Google Search that no such translator 
exists. It is possible but not trivial to write one. I probably could do 
that but would need some motivation.

___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Translating FORTRAN (77?) to Python?

2009-01-17 Thread Wayne Watson
Title: Signature.html




Yes, I sorted of wandered off in another direction and missed the
connection.

Sander Sweers wrote:

  On Fri, Jan 16, 2009 at 22:20, Wayne Watson
 wrote:
  
  
Will that do me any good if I implement my application under Win Python?

  
  
Your question was for a fotran compiler to compile the source code.
The fotran program is your reference point to compare the results to.

Greets
Sander

  


-- 


   Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

 (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)

 "The creation of the world did not occur at the 
  beginning of time; it occurs every day." -- M. Proust

Web Page: 



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Translating FORTRAN (77?) to Python?

2009-01-17 Thread Wayne Watson
Title: Signature.html




Many years ago I probably could too. I'm not interested anymore. It
seems to me the one solution above is plenty good. See Whittier post. 

bob gailer wrote:
Wayne
Watson wrote:
  
  I may have a need down the line to convert a
large number of lines of FORTRAN code to Python. Is there a good
translator available to do this?

  
  
I guess from the responses and Google Search that no such translator
exists. It is possible but not trivial to write one. I probably could
do that but would need some motivation.
  
  


-- 


   Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

 (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)

 "The creation of the world did not occur at the 
  beginning of time; it occurs every day." -- M. Proust

Web Page: 



___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Best Python3000 Tutorial for Beginner

2009-01-17 Thread Ian Egland
Hello all, I just joined this mailing list.

I am a beginner to programming in general and would really appreciate a
tutorial for Python3000 that at least covers the basics. I have tried
reading the manual, but I think it was written for more experienced
programmers wishing to switch to python rather than a beginner looking for
where to start. Most of the other tutorials I have found were for earlier
versions of Python, and because Python 3.0 was released on my birthday, I
decided I was meant to learn that release. ;-)

Anyway, any help would be appreciated. I will do my best to return the
favor.

-Ian
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Best Python3000 Tutorial for Beginner

2009-01-17 Thread Senthil Kumaran
On Sun, Jan 18, 2009 at 8:34 AM, Ian Egland  wrote:
> Hello all, I just joined this mailing list.
>
> I am a beginner to programming in general and would really appreciate a
> tutorial for Python3000 that at least covers the basics. I have tried

Hello Ian,
That is a nice reason to get started with a language.

However, you have to remember that Python 3.0 is not a new language at
all. It is just a backwards impatible release of the original almighty
pyhon, which just tends to increase its strength and clean its design
further.

I am not at all surprised that you did not find any beginner Python
3.0 tutorial. It might be coming out soon, but the curretly people
migrating to Python 3.0 are ones who already know python 2k well.

So, for your purposes I would suggest the following.

1) Get Beginner Python tutorial. (See Alan's tutorial in this mailing
list and also google for A Byte of Python)
2) Read and understand the language well. Get comfortable upto a point
where you can differentiate between string, unicode and bytes. I
should warn you that it might take months' time.

and now you can read this very beginner friendly introduction to Python 3k.
http://www.comp.leeds.ac.uk/nde/papers/teachpy3.html

Thanks,
Senthil
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Help with elif

2009-01-17 Thread Ian Egland
Wow, that was a quick response! Thanks all!

I have looked at a couple tutorials and whipped this up. However, attempting
to run it in IDLE results in a syntax error leaving my elif highlighted in
red. What's wrong? I've looked at the code and can't find any syntax errors-
though I've just started.

print("[Temperature Converter, First Edition]")
print("Created on January 17th, 2009 by Ian Egland")
temp1 = int(input("Please enter a temperature: "))
scale = input("Convert to (F)ahrenheit or (C)elcius?")
if scale == "F":
temp2 = (9/5)*temp1+32
print(temp1, "C =", temp2, "F"
elif scale == "C": # Error appears here.
temp2 = (5/9)*(temp1-32)
print(temp1, "F =", temp2, "C"
else:
print("Sorry, you must enter either an F or a C. Case-sensitive. Please
try again."


In regards to learning python, I've found that after I get somewhat-familiar
with a language, I want a programming problem to solve with what I've
learned. While learning Java, http://www.javabat.com has been my best
friend. (That is, as close to a best friend as programming website can be.)
Is there something like this for Java? Is one in the works?

-Ian
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


[Tutor] Fixed

2009-01-17 Thread Ian Egland
Found it- wasn't closing the ()'s in the print()'s. Thanks anyway, sorry for
filling your inbox.

-Ian
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Help with elif

2009-01-17 Thread Kent Johnson
On Sat, Jan 17, 2009 at 10:21 PM, Ian Egland  wrote:
> I have looked at a couple tutorials and whipped this up. However, attempting
> to run it in IDLE results in a syntax error leaving my elif highlighted in
> red. What's wrong? I've looked at the code and can't find any syntax errors-
> though I've just started.
>
> print("[Temperature Converter, First Edition]")
> print("Created on January 17th, 2009 by Ian Egland")
> temp1 = int(input("Please enter a temperature: "))
> scale = input("Convert to (F)ahrenheit or (C)elcius?")
> if scale == "F":
> temp2 = (9/5)*temp1+32
> print(temp1, "C =", temp2, "F"

Missing parenthesis in the above line.

> elif scale == "C": # Error appears here.

Syntax errors often appear on the line *following* the line with the
actual error.

Kent
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Best Python3000 Tutorial for Beginner

2009-01-17 Thread Brian Mathis
In addition to what was already mentioned, I found "Think Python"
useful.  It is aimed at both learning programming in general, and it
teaches in python specifically.  However, it's written for python 2.

http://www.greenteapress.com/thinkpython/thinkpython.html

On Sat, Jan 17, 2009 at 10:04 PM, Ian Egland  wrote:
> Hello all, I just joined this mailing list.
>
> I am a beginner to programming in general and would really appreciate a
> tutorial for Python3000 that at least covers the basics. I have tried
> reading the manual, but I think it was written for more experienced
> programmers wishing to switch to python rather than a beginner looking for
> where to start. Most of the other tutorials I have found were for earlier
> versions of Python, and because Python 3.0 was released on my birthday, I
> decided I was meant to learn that release. ;-)
>
> Anyway, any help would be appreciated. I will do my best to return the
> favor.
>
> -Ian
>
> ___
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor