Re: [Tutor] New to Python

2017-09-15 Thread Abdur-Rahmaan Janhangeer
1)
valuable resources :
sololearn
tutorialspoint python3

top tip : concentrate on concepts

good books for beginners
 there are many like
.. dive into python 3 available free online
.. automate the boring stuff available free online

 a good reference-like book:
.. Learning Python
.. Programming Python
both by Mark Lutz

Concerning the FAQ since i see it is prohibited to say RTFM, i propose the
faq link is given along with some kind words.

Abdur-Rahmaan Janhangeer,
Mauritius
abdurrahmaanjanhangeer.wordpress.com

On 7 Sep 2017 20:51, "Vikram Singh"  wrote:

> I've been learning Python from Google For Education
> . A little help will be
> appreciated regarding the right way and right tutorials to learn Python
> from. Thanks in advance.
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python

2017-09-08 Thread Alan Gauld via Tutor
On 08/09/17 08:35, George Fischhof wrote:

> As this is a really frequent question, maybe it would be good to put a
> short list (the answers cumulated no more than about 10 websites) into the
> welcome message of the Tutor mailing list.

The welcome message should be a very short (ideally one "screen" )
message about the mailing list itself. It could have a URL to an
FAQ if we had such a thing... Somebody tried to put a tutor FAQ
together a long time ago but I think it died. And the main FAQ
is probably too heavyweight for the typical tutor newbie.
(Although it might be better than nothing!)

Currently we have a link to the beginners page on the wiki.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python

2017-09-08 Thread George Fischhof
2017-09-07 20:39 GMT+02:00 boB Stepp :

> Welcome to Tutor!
>
> On Thu, Sep 7, 2017 at 8:14 AM, Vikram Singh
>  wrote:
> > I've been learning Python from Google For Education
> > . A little help will be
> > appreciated regarding the right way and right tutorials to learn Python
> > from. Thanks in advance.
>
> This is a very common question on this list as you might imagine.  If
> you go to the searchable Tutor list archives at
>
> https://www.mail-archive.com/tutor@python.org/
>
> and search for "learn python", you will get 8048 hits!  You might want
> to do that, look over the results and perhaps perform other searches
> for topics that more closely match your interest.
>
> One thing I notice about the Google course you link to is that it is
> Python 2-based.  The latest version of Python is now in version 3.6,
> and generally speaking, if you are just starting out with Python, you
> probably should be focusing your efforts on Python 3.
>
> As a fellow learner, I can recommend some things *not* to do:
>
> 1)  Keep buying bunches of interesting books on Python and not
> studying any of them thoroughly!  Instead, find a resource -- printed
> on paper or online -- that speaks to you and work through it
> thoroughly.
>
> 2)  Starting new project after new project and finishing very few of
> them!  Instead, pick something interesting and start working on it,
> planning on augmenting it as your knowledge grows in parallel with
> your more formal studying.
>
> 3)  Working earnestly for a while, then taking long breaks off!  If
> you are like me, you will tend to forget many things you have studied
> previously, even forgetting you have asked about these things
> previously on Tutor!!  Instead, try to work on at least a little bit
> of Python studying each and every day, longer when life allows.
>
> 4)  I have more I could share, but I think you take my points!
>
> If you have never done any programming, you may need to find a very
> gentle resource to start out with that explains not only Python, but
> general programming/computer science concepts in a lot of detail.
> OTOH, if you already have experience with programming, then you
> probably can greatly accelerate your learning progress, perhaps even
> getting by with studying the official Python tutorial at
>
> https://docs.python.org/3/tutorial/index.html
>
> Bear in mind that Python has its own culture and ways of doing things
> that can be a bit different from other languages you may have
> studied/worked in.  You might enjoy the "Zen of Python" by Tim Peters.
> You can access it in the Python interpreter by typing
>
> >>> import this
>
> I have been rambling a bit.  I just noticed that the searchable Tutor
> archive is back up and searched for all of my previous posts.  Five
> years and I have not come very far.  Do as I say and not as I do!!!
> ~(:>))
>
> And always ask questions here when you get stuck.  Try not to top
> post.  Give your OS and Python version and all other relevant
> information to allow the experts to diagnose your problem(s).  Always
> COPY AND PASTE both your relevant code and FULL ERROR TRACEBACK into a
> plain text email to Tutor.  Try to limit your code to just the part
> that is causing you to pull your hair out (If you still have any!
> ~(:>)) ).
>
> And come back with more specific goals for your self-study along with
> any relevant background.  Perhaps someone might be able to offer
> advice that is more tailored to your needs and goals.
>
> And again, welcome!  This is a very friendly and helpful place to learn!!
>
> Cheers!
>
>
> --
> boB
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>



Hi Tutors,

As this is a really frequent question, maybe it would be good to put a
short list (the answers cumulated no more than about 10 websites) into the
welcome message of the Tutor mailing list.

BR,
George
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python

2017-09-07 Thread boB Stepp
Welcome to Tutor!

On Thu, Sep 7, 2017 at 8:14 AM, Vikram Singh
 wrote:
> I've been learning Python from Google For Education
> . A little help will be
> appreciated regarding the right way and right tutorials to learn Python
> from. Thanks in advance.

This is a very common question on this list as you might imagine.  If
you go to the searchable Tutor list archives at

https://www.mail-archive.com/tutor@python.org/

and search for "learn python", you will get 8048 hits!  You might want
to do that, look over the results and perhaps perform other searches
for topics that more closely match your interest.

One thing I notice about the Google course you link to is that it is
Python 2-based.  The latest version of Python is now in version 3.6,
and generally speaking, if you are just starting out with Python, you
probably should be focusing your efforts on Python 3.

As a fellow learner, I can recommend some things *not* to do:

1)  Keep buying bunches of interesting books on Python and not
studying any of them thoroughly!  Instead, find a resource -- printed
on paper or online -- that speaks to you and work through it
thoroughly.

2)  Starting new project after new project and finishing very few of
them!  Instead, pick something interesting and start working on it,
planning on augmenting it as your knowledge grows in parallel with
your more formal studying.

3)  Working earnestly for a while, then taking long breaks off!  If
you are like me, you will tend to forget many things you have studied
previously, even forgetting you have asked about these things
previously on Tutor!!  Instead, try to work on at least a little bit
of Python studying each and every day, longer when life allows.

4)  I have more I could share, but I think you take my points!

If you have never done any programming, you may need to find a very
gentle resource to start out with that explains not only Python, but
general programming/computer science concepts in a lot of detail.
OTOH, if you already have experience with programming, then you
probably can greatly accelerate your learning progress, perhaps even
getting by with studying the official Python tutorial at

https://docs.python.org/3/tutorial/index.html

Bear in mind that Python has its own culture and ways of doing things
that can be a bit different from other languages you may have
studied/worked in.  You might enjoy the "Zen of Python" by Tim Peters.
You can access it in the Python interpreter by typing

>>> import this

I have been rambling a bit.  I just noticed that the searchable Tutor
archive is back up and searched for all of my previous posts.  Five
years and I have not come very far.  Do as I say and not as I do!!!
~(:>))

And always ask questions here when you get stuck.  Try not to top
post.  Give your OS and Python version and all other relevant
information to allow the experts to diagnose your problem(s).  Always
COPY AND PASTE both your relevant code and FULL ERROR TRACEBACK into a
plain text email to Tutor.  Try to limit your code to just the part
that is causing you to pull your hair out (If you still have any!
~(:>)) ).

And come back with more specific goals for your self-study along with
any relevant background.  Perhaps someone might be able to offer
advice that is more tailored to your needs and goals.

And again, welcome!  This is a very friendly and helpful place to learn!!

Cheers!


-- 
boB
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] new to python

2017-07-26 Thread N6Ghost



On 7/25/2017 12:43 AM, Alan Gauld via Tutor wrote:

On 25/07/17 04:58, N6Ghost wrote:


this code works
f = open("C:/coderoot/python3/level1/inputfile.txt", 'r')
for line in f:
  for line in f:
  #print(line.rstrip())
  print(line)

f.close()
the out put skips the first line of the inputfile and puts a blank line
inbetween


I'm not sure why you have two for loops? Why did you do that?
Can you explain your thinking there?

Remove one of the for... lines.

Your code does this:


f = open("C:/coderoot/python3/level1/inputfile.txt", 'r')

open the file and assign it to 'f'


for line in f:

get the first line from f and assign it to 'line'


  for line in f: print(line)

get the next line from f and assign it to 'line'
This overwrites the value from the first for loop above.
The line is then printed.

The second loop then repeats for all of the remaining
lines in the file. At the end of the second for loop
control returns to the top for loop. But, since the file
is now empty, the top loop never gets any more values
from f, so it terminates.

The blank lines are caused by the fact that the lines
in the file end in a newline character and print() adds
a newline of its own. Either reinstate your rstrip()
call or stop print() adding a newline with

print(line, end='')

I'm also not sure why you posted two copies of
your code? I assume you only use one since otherwise
you would have told us that you got two lots of output?

HTH


final working code for this method:
# open meth 1
f = open("C:/coderoot/python3/level1/inputfile.txt", 'r')
for line in f:
#print(line.rstrip())
print(line.strip())
j = line
#print ("below new var used")
#print (j)

f.close()


thanks for the replys, not sure why i had the second for loop. removing 
that remove some of the oddball behavioral issues.


next going to look into using the with


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] new to python

2017-07-25 Thread Alan Gauld via Tutor
On 25/07/17 04:58, N6Ghost wrote:

> this code works

> f = open("C:/coderoot/python3/level1/inputfile.txt", 'r')
> for line in f:
>  for line in f:
>  #print(line.rstrip())
>  print(line)
> 
> f.close()

> the out put skips the first line of the inputfile and puts a blank line 
> inbetween


I'm not sure why you have two for loops? Why did you do that?
Can you explain your thinking there?

Remove one of the for... lines.

Your code does this:

> f = open("C:/coderoot/python3/level1/inputfile.txt", 'r')

open the file and assign it to 'f'

> for line in f:

get the first line from f and assign it to 'line'

>  for line in f: print(line)

get the next line from f and assign it to 'line'
This overwrites the value from the first for loop above.
The line is then printed.

The second loop then repeats for all of the remaining
lines in the file. At the end of the second for loop
control returns to the top for loop. But, since the file
is now empty, the top loop never gets any more values
from f, so it terminates.

The blank lines are caused by the fact that the lines
in the file end in a newline character and print() adds
a newline of its own. Either reinstate your rstrip()
call or stop print() adding a newline with

print(line, end='')

I'm also not sure why you posted two copies of
your code? I assume you only use one since otherwise
you would have told us that you got two lots of output?

HTH
-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] new to python

2017-07-25 Thread Andre Engels
The problem here is that you have doubled the "for line in f:" line.
Given that you say you know some programming, I'll just cut to the
technical name of the problem you are having: You are changing the
value of a loop variable (by starting an inner loop with the same loop
variable) inside a loop. Doing that in Python leads to behaviour that
is hard to understand and almost never what you intended.


On Tue, Jul 25, 2017 at 5:58 AM, N6Ghost  wrote:
>
>
> On 7/23/2017 1:03 AM, Alan Gauld via Tutor wrote:
>>
>> On 23/07/17 07:26, N6Ghost wrote:
>>
>>> f = open("C:\coderoot\python3\level1\inputfile.txt", 'r')
>>> for line in file:
>>
>> Note that you have no variable called 'file'.
>> So this line doesn't make sense.
>>
>>>   for line in f:
>>>   print(line.rstripe())
>>
>> This bit will work if you omit the line above and
>> fix the indentation. (and remove the 'e' from strip()
>>
>>>   f.close()
>>
>> This should be outside the loop, you don't want
>> to close the file after every line.
>>
>> Finally, there is another way to do this which
>> is considered 'better'/more Pythonic:
>>
>> with open("C:\coderoot\python3\level1\inputfile.txt", 'r') as f:
>>   for line in f:
>>   print(line.strip())
>>
>> Notice with this construct the closing of the file is
>> handled for you.
>>
>>> any idea why that does not work?
>>
>> When posting questions always include the full error text.
>> Although apparently cryptic it actually contains a lot of
>> useful detail which saves us from making guesses.
>>
>
>
> this code works
> f = open("C:/coderoot/python3/level1/inputfile.txt", 'r')
> for line in f:
> for line in f:
> #print(line.rstrip())
> print(line)
>
> f.close()f = open("C:/coderoot/python3/level1/inputfile.txt", 'r')
> for line in f:
> for line in f:
> #print(line.rstrip())
> print(line)
>
> f.close()
>
> the out put skips the first line of the inputfile and puts a blank line
> inbetween
>
> inputfile is:
> tom
> jerry
> make
> windows
> linux
>
> -N6Ghost
>
>
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor



-- 
André Engels, andreeng...@gmail.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] new to python

2017-07-25 Thread N6Ghost



On 7/23/2017 1:03 AM, Alan Gauld via Tutor wrote:

On 23/07/17 07:26, N6Ghost wrote:


f = open("C:\coderoot\python3\level1\inputfile.txt", 'r')
for line in file:

Note that you have no variable called 'file'.
So this line doesn't make sense.


  for line in f:
  print(line.rstripe())

This bit will work if you omit the line above and
fix the indentation. (and remove the 'e' from strip()


  f.close()

This should be outside the loop, you don't want
to close the file after every line.

Finally, there is another way to do this which
is considered 'better'/more Pythonic:

with open("C:\coderoot\python3\level1\inputfile.txt", 'r') as f:
  for line in f:
  print(line.strip())

Notice with this construct the closing of the file is
handled for you.


any idea why that does not work?

When posting questions always include the full error text.
Although apparently cryptic it actually contains a lot of
useful detail which saves us from making guesses.




this code works
f = open("C:/coderoot/python3/level1/inputfile.txt", 'r')
for line in f:
for line in f:
#print(line.rstrip())
print(line)

f.close()f = open("C:/coderoot/python3/level1/inputfile.txt", 'r')
for line in f:
for line in f:
#print(line.rstrip())
print(line)

f.close()

the out put skips the first line of the inputfile and puts a blank line 
inbetween


inputfile is:
tom
jerry
make
windows
linux

-N6Ghost

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] new to python

2017-07-24 Thread Mats Wichmann
On 07/24/2017 04:32 PM, N6Ghost wrote:

> update code:
> f = open("C:\coderoot\python3\level1\inputfile.txt", 'r')
> for line in f:
> for line in f:
> print(line.rstripe())
> 
> f.close()
> 
> 
> C:\coderoot\python3\level1>python secondscript.py
> Traceback (most recent call last):
>   File "secondscript.py", line 5, in 
> print(line.rstripe())
> AttributeError: 'str' object has no attribute 'rstripe'

You presumably meant 'rstrip' (strip from right) rather than 'rstripe'.
With errors like this, look in the documentation to see the available
methods:

https://docs.python.org/3/library/stdtypes.html#string-methods
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] new to python

2017-07-24 Thread N6Ghost



On 7/23/2017 1:03 AM, Alan Gauld via Tutor wrote:

On 23/07/17 07:26, N6Ghost wrote:


f = open("C:\coderoot\python3\level1\inputfile.txt", 'r')
for line in file:

Note that you have no variable called 'file'.
So this line doesn't make sense.


  for line in f:
  print(line.rstripe())

This bit will work if you omit the line above and
fix the indentation. (and remove the 'e' from strip()


  f.close()

This should be outside the loop, you don't want
to close the file after every line.

Finally, there is another way to do this which
is considered 'better'/more Pythonic:

with open("C:\coderoot\python3\level1\inputfile.txt", 'r') as f:
  for line in f:
  print(line.strip())

Notice with this construct the closing of the file is
handled for you.


any idea why that does not work?

When posting questions always include the full error text.
Although apparently cryptic it actually contains a lot of
useful detail which saves us from making guesses.



update code:
f = open("C:\coderoot\python3\level1\inputfile.txt", 'r')
for line in f:
for line in f:
print(line.rstripe())

f.close()


C:\coderoot\python3\level1>python secondscript.py
Traceback (most recent call last):
  File "secondscript.py", line 5, in 
print(line.rstripe())
AttributeError: 'str' object has no attribute 'rstripe'




___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] new to python

2017-07-23 Thread Mats Wichmann
On 07/23/2017 09:16 AM, Alex Kleider wrote:
> On 2017-07-23 01:06, Anish Tambe wrote:
>>> for line in file:
>>
>> This line is not required as the you have opened your file to 'f'.
>> 'file' is a built-in class. Type -
>> help(file)
>> on the interpreter to know more about it.
> 
> This appears to be true in python2x but not in python3:
> 
> alex@X301n3:~$ python3
> Python 3.4.3 (default, Nov 17 2016, 01:11:57)
> [GCC 4.8.4] on linux
> Type "help", "copyright", "credits" or "license" for more information.
 help(file)
> Traceback (most recent call last):
>   File "", line 1, in 
> NameError: name 'file' is not defined
 exit()
> alex@X301n3:~$ python
> Python 2.7.6 (default, Oct 26 2016, 20:32:47)
> [GCC 4.8.4] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
 help(file)
> Help on class file in module __builtin__:
> 
> class file(object)
>  |  file(name[, mode[, buffering]]) -> file object
>  |
> ...

It is nonetheless still true that Python provides context manager
support for file objects that behave the same way as described (that is,
when handle - called 'f' in the example above - goes out of scope, it is
closed for you).  Otherwise, the relevant documentation on file objects
is now in the IO discussion:

https://docs.python.org/3/library/io.html

> Also puzzling is that the 'intro' to python2 declares itself to be 'on
> linux2' vs just 'on linux' in the case of python3.  (Something I'd not
> previously noticed.)

That's just a cleanup of an old issue, Python3 dropped the "linux2"
thing (which was never a great idea, linux kernels are now 4.x after 2.x
lived for a very long time, Python never followed those changes nor did
it need to);

FWIW, the preferred method now to check if a host is linux is to do:

if sys.platform.startswith("linux"):

instead of checking explicitly for a string "linux", "linux2", etc.



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] new to python

2017-07-23 Thread Alex Kleider

On 2017-07-23 01:06, Anish Tambe wrote:

for line in file:


This line is not required as the you have opened your file to 'f'.
'file' is a built-in class. Type -
help(file)
on the interpreter to know more about it.


This appears to be true in python2x but not in python3:

alex@X301n3:~$ python3
Python 3.4.3 (default, Nov 17 2016, 01:11:57)
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.

help(file)

Traceback (most recent call last):
  File "", line 1, in 
NameError: name 'file' is not defined

exit()

alex@X301n3:~$ python
Python 2.7.6 (default, Oct 26 2016, 20:32:47)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.

help(file)

Help on class file in module __builtin__:

class file(object)
 |  file(name[, mode[, buffering]]) -> file object
 |
...

Also puzzling is that the 'intro' to python2 declares itself to be 'on 
linux2' vs just 'on linux' in the case of python3.  (Something I'd not 
previously noticed.)




___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] new to python

2017-07-23 Thread Peter Otten
N6Ghost wrote:

> C:\coderoot\python3\level1>python
> Python 3.6.2 (v3.6.2:5fd33b5, Jul  8 2017, 04:14:34) [MSC v.1900 32 bit
> (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> 
> /windows 10 x64
> 
> new to python, but not really new to programming.
> 
> going through the beginners docs, I am stuck on the file handling opening:
> 
> 
>my code so far:
> 
> f = open("C:\coderoot\python3\level1\inputfile.txt", 'r')

While this one is OK using backslashes in a normal string will sooner or 
later produce erroneous paths:

>>> print("C:\test")
C:  est

Oops, \t is a TAB char, not a backslash followed by a 't'. Possible 
solutions are 

- always escape the backslash "C:\\test"
- use raw strings r"C:\test"
- use forward slashes for file paths: "C:/test" (yes, it works even on
  windows)

> for line in file:

It looks like file isn't defined anywhere.

>  for line in f:
>  print(line.rstripe())
>  f.close()

It looks like f.close() is indentend one level to deep -- the file will be 
closed on the second iteration of the inner loop. 

Indentation is important as Python uses it to represent the code structure.  
If your editor alows it ensure that it converts one hit of the TAB key into 
four spaces to avoid discrepancies between what you see and what you have.
 
> I want to try the different methods of opening files and reading them.
> and processing the data.  from there I will then start with writing to
> files.
> 
> 
> any idea why that does not work?

Since you can already program:

Read the traceback and error message carefully -- they prodvide valuable 
hints. 

If you cannot make sense of them please provide them along with the code 
that produced them; use cut-and-paste for both code and traceback.

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] new to python

2017-07-23 Thread Anish Tambe
> for line in file:

This line is not required as the you have opened your file to 'f'.
'file' is a built-in class. Type -
help(file)
on the interpreter to know more about it.

> for line in f:
> print(line.rstripe())
> f.close()

Are you sure that you need to close the file after reading each line?

>
> I want to try the different methods of opening files and reading them.
and processing the data.  from there I will then start with writing to
files.

Bonus : read about the 'with' keyword.

> any idea why that does not work?

When you say the code does not work, you should provide the exact error or
stacktrace that you see.

Thanks,
Anish
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] new to python

2017-07-23 Thread Alan Gauld via Tutor
On 23/07/17 07:26, N6Ghost wrote:

> 
> f = open("C:\coderoot\python3\level1\inputfile.txt", 'r')
> for line in file:

Note that you have no variable called 'file'.
So this line doesn't make sense.

>  for line in f:
>  print(line.rstripe())

This bit will work if you omit the line above and
fix the indentation. (and remove the 'e' from strip()

>  f.close()

This should be outside the loop, you don't want
to close the file after every line.

Finally, there is another way to do this which
is considered 'better'/more Pythonic:

with open("C:\coderoot\python3\level1\inputfile.txt", 'r') as f:
 for line in f:
 print(line.strip())

Notice with this construct the closing of the file is
handled for you.

> any idea why that does not work?

When posting questions always include the full error text.
Although apparently cryptic it actually contains a lot of
useful detail which saves us from making guesses.


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python

2016-10-27 Thread Danny Yoo
> program-they just do it. Also noticed-when starting new file sometimes I
> see run at the top sometimes not? Lots of questions. Familiar with
> programming  in C.


If you're a database and C developer, then you probably have enough
experience to go through the Python tutorial, as it is aimed for the
experienced programmer.

https://docs.python.org/3/tutorial/interpreter.html#using-the-python-interpreter
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python

2016-10-27 Thread Alan Gauld via Tutor
On 28/10/16 01:05, Rusty Bayles wrote:
> Thanks for the reply Alan,
> Could you please tell me more detail on the videos? Like who made them.

Some are just amateurs others are professional (or at least Youtube
regulars)

Here are a couple of links, but to be honest just about any of them
would meet your immediate needs.


Short (my recommendation):
https://www.*youtube*.com/watch?v=bOvqYw1SZJg

longer:
https://www.*youtube*.com/watch?v=lBkcDFRA958



 1.




Very different styles but they both contain the essentials.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python

2016-10-27 Thread Alan Gauld via Tutor
On 27/10/16 23:41, Rusty Bayles wrote:
> I  just installed 3.5.2 interpreter and cannot  figure out how to  run
> program.  

I strongly suggest you go to Youtube and search for IDLE.
There are several short (3-10min) videos there that should
make it clear where you are going wrong. Watch a couple of them.


> ...When I run a program (after importinh sqllite and doing
> connection setups and attempting to setup table. When I press run (F5?) the
> first line in the program fails at 3.5.2 on the five? 

It looks like you are typing (cut n pasting?) the Python prompt into
your program.

Its possible you are trying to save an interactive session and then
run it, but that won't work (unfortunately, it would be good if you could!)

> ... if I setup new file and start typing sometimes I get prompt 
> and sometimes not?

New file should always be a blank text screen, I'm not sure
how you are getting a prompt.

My best suggestion is to watch a couple of the video tutorials.

Danny Yoo also has an HTML tutorial but it's quicker to watch
the vids - and if you have experience in coding you should
get the point pretty quickly.

If you are stuck Danny's tutorial is here:

 http://hkn.eecs.berkeley.edu/~dyoo/python/idle_intro/index.html

Its quite old so a few menu options/labels may have changed but
the basics are the same.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python, Already Confused

2016-09-20 Thread Steven D'Aprano
On Mon, Sep 19, 2016 at 11:01:30PM +, Gampper, Terry wrote:
> Hello
> I started my journey with Python last week and find it to be an 
> easy-to-learn language. I am currently teaching introduction to 
> computer programming. One of the assignments we are working on 
> involves an instructor giving a series of 5 tests, and the lowest 
> score is dropped, then calculating the percent. Here is my attempt at 
> coding:

Thank you for showing your code!

Do I understand that you are the *teacher* in this course, rather than a 
student? We try not to do student's work for them, although we may 
sometimes guide them towards the right direction. But if you are the 
teacher, then of course we're happy to help.


> name = input("Enter Student's Name: " )
> tscore1 = input ("Enter test score 1: ")
> tscore2 = input ("Enter test score 2: ")
> tscore3 = input ("Enter test score 3: ")
> tscore4 = input ("Enter test score 4: ")
> tscore5 = input ("Enter test score 5: ")

Here the various scores are all strings. I recommend that you convert 
them to int immediately:

tscore1 = int(input("Enter test score 1: "))

etc. That will avoid the problems you have below.


> total_tscore = int(tscore1) + int(tscore2) + int(tscore3) + int(tscore4) + 
> int(tscore5)

You add the scores as numbers. But the next line:

> low_tscore = min(tscore1,tscore2,tscore3,tscore4,tscore5)

you pick the score that comes first *as a string*, not as a number. 
String comparisons are in lexicographic order:

"1000" < "9" because "1" comes before "9"
but 1000 > 9 because 1000 is a larger number.

So that's why you're getting unexpected results for the lowest score.


> adjusted_tscore = int(total_tscore) - int(low_tscore)

No need to convert total_tscore into an int, as it already is one.

> percent = int(adjusted_tscore/400*100)

This will truncate the percentages to the whole number part. That is, if 
the percentage calculates as (say) 49.%, it will round down to 49, 
rather than round to the nearest value 50.

Rather than int(), perhaps you should use round()?


Hope that helps!



-- 
Steven
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python, Already Confused

2016-09-20 Thread Joel Goldstick
You should probably convert scores to ints on input.  At any rate,
here is your problem:

low_tscore = min(tscore1,tscore2,tscore3,tscore4,tscore5)

You need to convert tscore1, etc. to ints, otherwise min will give
lexical comparison (alphabetic order), not numeric order

On Mon, Sep 19, 2016 at 7:01 PM, Gampper, Terry  wrote:
> Hello
> I started my journey with Python last week and find it to be an easy-to-learn 
> language. I am currently teaching introduction to computer programming. One 
> of the assignments we are working on involves an instructor giving a series 
> of 5 tests, and the lowest score is dropped, then calculating the percent. 
> Here is my attempt at coding:
>
> name = input("Enter Student's Name: " )
> tscore1 = input ("Enter test score 1: ")
> tscore2 = input ("Enter test score 2: ")
> tscore3 = input ("Enter test score 3: ")
> tscore4 = input ("Enter test score 4: ")
> tscore5 = input ("Enter test score 5: ")
> total_tscore = int(tscore1) + int(tscore2) + int(tscore3) + int(tscore4) + 
> int(tscore5)
> low_tscore = min(tscore1,tscore2,tscore3,tscore4,tscore5)
> adjusted_tscore = int(total_tscore) - int(low_tscore)
> percent = int(adjusted_tscore/400*100)
> print("The sum of the 5 tests is",total_tscore)
> print("The lowest test score is thrown out",low_tscore)
> print("The adjusted score is",adjusted_tscore)
> print("Student",name, "has a score of",percent, "percent")
>
> I ran the program several times using random numbers and I found that the 
> results were not consistent. Here are a couple of runs:
>
>  RESTART: /Users/tgampper/Documents/Python/assign2.py 
> Enter Student's Name: Joe
> Enter test score 1: 78
> Enter test score 2: 89
> Enter test score 3: 90
> Enter test score 4: 78
> Enter test score 5: 99
> The sum of the 5 tests is 434
> The lowest test score is thrown out 78
> The adjusted score is 356
> Student Joe has a score of 89 percent

>  RESTART: /Users/tgampper/Documents/Python/assign2.py 
> Enter Student's Name: Sally
> Enter test score 1: 78
> Enter test score 2: 89
> Enter test score 3: 90
> Enter test score 4: 78
> Enter test score 5: 100
> The sum of the 5 tests is 435
> The lowest test score is thrown out 100
> The adjusted score is 335
> Student Sally has a score of 83 percent

>
> Notice the scores for test 5 for each student. My conclusion is that if the 
> score is <100, the lowest score is properly displayed, but if the score is 
> >=100, then the lowest score is equal to the highest score. Doesn't make 
> sense to me. Do you have any ideas? Thanks!
> --
> Terry Gampper
> Adjunct INFO Instructor
> Metropolitan Community College, Omaha NE
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor



-- 
Joel Goldstick
http://joelgoldstick.com/blog
http://cc-baseballstats.info/stats/birthdays
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New at Python

2014-10-05 Thread R. Alan Monroe
 while loop to compute
 the sum of the cubes of the first n counting numbers

 do you have any suggestions as to how I need to look at a problem
 and to “identify” what exactly it is asking for,

Can you do it on paper? If I gave you 5 as a starting point, could
you write down on your paper 1 cubed plus 2 cubed plus 3 cubed plus 4
cubed plus 5 cubed and arrive at a correct sum?

Alan

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New at Python

2014-10-05 Thread Alan Gauld

On 05/10/14 23:40, Mike Spaulding wrote:

Given that n refers to a positive int use a while loop to compute the sum of
the cubes of the first n counting numbers, and associate this value with
total . Use no variables  other than n , k , and total .



lab and the accompanying online book.  The biggest problem that I am having
is trying to figure out how to start off on problems such as the one above.


You need to break the problem into sub problems until you wind up with 
things you can do. For example in the above exercise:


1) can you associate a variable called n with an integer?
2) can you use a while loop to iterate a number of times?
3) can you calculate the cube of a number?
4) can you total two numbers and store the result?
5) can you display the final total?

Assuming you can do each of those bits you need to organize
them into a structure to form your program.

You need to store a value in n and use a while loop to loop
that many times. You need a counter to store the number of
loops. For each time through the loop you need to calculate
the cube of the counter. You then need to add that result
to the running total.

When the loop ends you need to report the total.

Its the same with most beginner exercises, you divide it into
hunks and solve each chunk. Then assemble the bits to solve
the whole.

Once the problems get a lot bigger you need to apply some more
advanced techniques which we call analysis and design. But for
beginner stuff the divide and conquer approach works just fine.

Does that help?
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New at Python

2014-10-05 Thread Danny Yoo
On Sun, Oct 5, 2014 at 3:40 PM, Mike Spaulding spauldingfam...@twc.com wrote:
 Given that n refers to a positive int use a while loop to compute the sum of
 the cubes of the first n counting numbers, and associate this value with
 total . Use no variables  other than n , k , and total .

 Hi, I am really a rookie at Python and I am just learning some of the
 language and some of the functions etc.  I am using Pearson’s Programming
 lab and the accompanying online book.  The biggest problem that I am having
 is trying to figure out how to start off on problems such as the one above.


Hi Mike,

If you can point out previous exercises that you've done, that may
help us point out similarities between the things you've done before,
and this particular problem.  (The material you're pointing out is not
freely available, so I can not search for it not see what problems
preceded the one you're working on now.)


Generally, a problem solving strategy such as:

http://en.wikipedia.org/wiki/How_to_Solve_It

should be helpful in breaking this down.


R. Alan Monroe suggests that you try it by hand first.  This is a
good approach to start: you need to _understand_ what's being asked
before trying to instruct a computer by hand.  Do you understand the
problem statement?  What is the input, and what is the expected
output?

Let's get that cleared up before talking about the code.


Good luck!
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python..Need help

2014-09-04 Thread Joel Goldstick
On Thu, Sep 4, 2014 at 8:49 AM, Felisha Lawrence
felisha.lawre...@gmail.com wrote:
 Hello,
 I have a question regarding strings in python. I have a directory on my
 MacBook Bro of about 13 files. I need to alter the file endings in that
 directory. The files are on the order of
 'swp.113006004000_KLWX_0.0.5_PPI_v2','swp.113006004000_KLWX_0.0.5_PPI_v3'. I
 need to remove the characters after the 'v' and replace with v20. All of the
 endings of the files are sequential _v2, _v3,_v4, _v5. I need all of these
 characters to be the same (i.e. v20). I would like to know which modules are
 best to use, and how to use loops to alter them. Any help you can provide
 would be great.


Check out the documentation for os.walk and os.rename.  The first to
collect you filenames, and the second to rename them.

 Thanks,
 Felisha Lawrence

 --
 Felisha Lawrence
 Howard University Program for Atmospheric Sciences(HUPAS), Graduate Student
 NASA URC/BCCSO Graduate Fellow
 NOAA NCAS Graduate Fellow
 Graduate Student Association for Atmospheric Sciences(GSAAS), Treasurer
 (240)-535-6665 (cell)
 felisha.lawre...@gmail.com (email)

 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 https://mail.python.org/mailman/listinfo/tutor




-- 
Joel Goldstick
http://joelgoldstick.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python..Need help

2014-09-04 Thread taserian
Is there anything different between the filenames aside from that suffix
_vXX? If not, then you'll run into problems after the first filename is
changed; further attempts won't allow the change, since there's already a
file with that same name.

AR


On Thu, Sep 4, 2014 at 8:49 AM, Felisha Lawrence felisha.lawre...@gmail.com
 wrote:

 Hello,
 I have a question regarding strings in python. I have a directory on my
 MacBook Bro of about 13 files. I need to alter the file endings in
 that directory. The files are on the order of
 'swp.113006004000_KLWX_0.0.5_PPI_v2','swp.113006004000_KLWX_0.0.5_PPI_v3'.
 I need to remove the characters after the 'v' and replace with v20. All of
 the endings of the files are sequential _v2, _v3,_v4, _v5. I need all of
 these characters to be the same (i.e. v20). I would like to know which
 modules are best to use, and how to use loops to alter them. Any help you
 can provide would be great.


 Thanks,
 Felisha Lawrence

 --
 Felisha Lawrence
 Howard University Program for Atmospheric Sciences(HUPAS), Graduate
 Student
 NASA URC/BCCSO Graduate Fellow
 NOAA NCAS Graduate Fellow
 Graduate Student Association for Atmospheric Sciences(GSAAS), Treasurer
 (240)-535-6665 (cell)
 felisha.lawre...@gmail.com (email)

 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 https://mail.python.org/mailman/listinfo/tutor


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python..Need help

2014-09-04 Thread Alan Gauld

On 04/09/14 13:49, Felisha Lawrence wrote:


'swp.113006004000_KLWX_0.0.5_PPI_v2','swp.113006004000_KLWX_0.0.5_PPI_v3'.
I need to remove the characters after the 'v' and replace with v20. All of
the endings of the files are sequential _v2, _v3,_v4, _v5. I need all of
these characters to be the same (i.e. v20).


How else will you differentiate them if the files are all the same? Do 
you need to add a sequence number or do you really want to concateate 
the files into one big file?



I would like to know which
modules are best to use, and how to use loops to alter them.


You can use os.listdir to get all the filenames in a single folder

You can use glob.glob to get a subset of the files
(using * and ? as wildvards)

You can use os.walk to get all the files/folders from a directry tree


Once you have the list of files you can use a for loop to access each name.

You can the use

string.replace()  to make simple changes
re.sub() to replace regular expressions

Or you could use string slicing to replace certain characters
based on position, wjhich might work well for your case.

HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python..Need help

2014-09-04 Thread Danny Yoo
 I have a question regarding strings in python. I have a directory on my
 MacBook Bro of about 13 files. I need to alter the file endings in that
 directory. The files are on the order of
 'swp.113006004000_KLWX_0.0.5_PPI_v2','swp.113006004000_KLWX_0.0.5_PPI_v3'. I
 need to remove the characters after the 'v' and replace with v20. All of the
 endings of the files are sequential _v2, _v3,_v4, _v5. I need all of these
 characters to be the same (i.e. v20). I would like to know which modules are
 best to use, and how to use loops to alter them. Any help you can provide
 would be great.

Hi Felisha,


Do you have any prior programming experience?

Your subject line suggests that you are new to Python.  Are you
familiar with any other programming?  Give us more details, and we may
be able to provide more appropriate advice.  In lack of background
information, we will assume for the moment that you have some basic
programming skills, and will point to documentation where appropriate.


We can point to:

https://docs.python.org/2/tutorial/

to get a quick-and-dirty introduction to the language.



For the operations you'll be doing, you probably want:

1.  Some way to collect the set of file names.  The glob module might
be appropriate:

https://docs.python.org/2/library/glob.html


2.  Basic string manipulation skills to map the string:

swp.113006004000_KLWX_0.0.5_PPI_v2

to its replacement string:

swp.113006004000_KLWX_0.0.5_PPI_v20


For this particular pattern matching and string replacement, it might
be enough to find the rightmost index for the substring _v using a
string's rfind() method:

https://docs.python.org/2/library/stdtypes.html#str.rfind

string slicing (https://docs.python.org/2/tutorial/introduction.html#strings)
to chop off the tail, and then a string append to put the replacement
_v20 at the end.


For anything more sophisticated, you might want to investigate regular
expressions.

https://docs.python.org/2/howto/regex.html


3.  Functions to interact with the operating system, to tell the
operating system to rename a file from the old name to its
replacement.  Possibly os.rename():

https://docs.python.org/2/library/os.html#os.rename



Please feel free to ask more questions.  Good luck!
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python..Need help

2014-09-04 Thread Danny Yoo
On Thu, Sep 4, 2014 at 12:05 PM, taserian taser...@gmail.com wrote:
 Is there anything different between the filenames aside from that suffix
 _vXX? If not, then you'll run into problems after the first filename is
 changed; further attempts won't allow the change, since there's already a
 file with that same name.


Ah.  Nice catch!  Yeah, that's a potential problem with the problem
statement.  Felisha, please clarify this point, because it's a big
one.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python..Need help

2014-09-04 Thread Cameron Simpson

On 04Sep2014 15:01, Joel Goldstick joel.goldst...@gmail.com wrote:

On Thu, Sep 4, 2014 at 8:49 AM, Felisha Lawrence
felisha.lawre...@gmail.com wrote:

I have a question regarding strings in python. I have a directory on my
MacBook Bro of about 13 files. I need to alter the file endings in that
directory. The files are on the order of
'swp.113006004000_KLWX_0.0.5_PPI_v2','swp.113006004000_KLWX_0.0.5_PPI_v3'. I
need to remove the characters after the 'v' and replace with v20. All of the
endings of the files are sequential _v2, _v3,_v4, _v5. I need all of these
characters to be the same (i.e. v20). I would like to know which modules are
best to use, and how to use loops to alter them. Any help you can provide
would be great.



Check out the documentation for os.walk and os.rename.  The first to
collect you filenames, and the second to rename them.


os.listdir will be far easier than os.walk if it is a single flat directory.

Cheers,
Cameron Simpson c...@zip.com.au

Knox's box is a 286. Fox in Socks does hacks and tricks
Knox's box is hard to fix.   To fix poor Knox's box for kicks.
- David Mar m...@physics.su.oz.au,
  as quoted by John Mackin j...@civil.su.oz.au
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python..Need help

2014-09-04 Thread Felisha Lawrence
These are all the files. No two filenames are the same



swp.1120630020111.KLWX.0.0.5_PPI_v2
swp.1120630020143.KLWX.0.0.9_PPI_v3
swp.1120630020215.KLWX.0.1.3_PPI_v4
swp.1120630020247.KLWX.0.1.8_PPI_v5
swp.1120630020302.KLWX.0.2.4_PPI_v6
swp.1120630020316.KLWX.0.3.1_PPI_v7
swp.1120630020330.KLWX.0.4.0_PPI_v8
swp.1120630020344.KLWX.0.5.1_PPI_v9
swp.1120630020358.KLWX.0.6.4_PPI_v10
swp.1120630020411.KLWX.0.8.0_PPI_v11
swp.1120630020424.KLWX.0.10.0_PPI_v12
swp.1120630020437.KLWX.0.12.5_PPI_v13
swp.1120630020451.KLWX.0.15.6_PPI_v14
swp.1120630020504.KLWX.0.19.5_PPI_v15



On Thu, Sep 4, 2014 at 4:27 PM, Danny Yoo d...@hashcollision.org wrote:

 On Thu, Sep 4, 2014 at 12:05 PM, taserian taser...@gmail.com wrote:
  Is there anything different between the filenames aside from that suffix
  _vXX? If not, then you'll run into problems after the first filename is
  changed; further attempts won't allow the change, since there's already a
  file with that same name.


 Ah.  Nice catch!  Yeah, that's a potential problem with the problem
 statement.  Felisha, please clarify this point, because it's a big
 one.




-- 
Felisha Lawrence
Howard University Program for Atmospheric Sciences(HUPAS), Graduate Student

NASA URC/BCCSO Graduate Fellow
NOAA NCAS Graduate Fellow
Graduate Student Association for Atmospheric Sciences(GSAAS), Treasurer
(240)-535-6665 (cell)
felisha.lawre...@gmail.com (email)
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python - print function - invalid syntax

2014-08-05 Thread Greg Markham
On Mon, Aug 4, 2014 at 5:13 PM, Alan Gauld alan.ga...@btinternet.com
wrote:

 On 05/08/14 00:21, Greg Markham wrote:

  but I'm running into a syntax error


 As others have said you are getting the expected error when running Python
 v3 code under Python v2.

 How exactly are you running the program? It looks like somehow you
 are picking up Python v2 when you run the script even though your python
 -V is showing v3.

 BTW. Which OS are you using? It shouldn't affect the cause but
 it helps with the debugging!


  For clarity, the full program reads as follows:


 # Game Over - Version 2
 # Demonstrates the use of quotes in strings
 # Python Programming for the Absolute Beginner, 3rd ed - Ch 2
 # Greg Markham - Aug 04, 2014

 print(Program 'Game Over' 2.0)

 print(Same, message, as before)

 print(Just,
a bit,
bigger)


 Does all of the above print out correctly? Can you send
 us a cut n paste of the exact output of the program?



 print(Here, end= )
 print(it is...)

 print(
  
   _   ___   ___  ___   _
  /  ___| /   | /   |/   | |  ___|
  | |/ /| |/ /|   /| | | |__
  | |  _/ ___ |   / / |__/ | | |  __|
  | |_| |  / /  | |  / /   | | | |___
  \_/ /_/   |_| /_/|_| |_|

   _   _ _   _   _
  /  _  \ | |   / / |  ___| |  _  \
  | | | | | |  / /  | |__   | |_| |
  | | | | | | / /   |  __|  |  _  /
  | |_| | | |/ /| |___  | | \ \
  \_/ |___/ |_| |_|  \_\

  
   )

 input(\n\nPress the enter key to exit.)


 finally you could try putting the following at the very top of your
 program:

 import sys
 print(sys.version)

 That will definitively prove that you are actually
 running v3 on the file...


Aaaah, brilliant!  You were right!

I:\Programming\Scripts\Learning\chapter02game_over2.py
2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)]

I installed ver 2.7.8 initially then some time later installed ver 3.4.1
upon starting the above mentioned book which uses that version.  I thought
I had handled the problem by renaming the executables to python27.exe and
pythonw27.exe as well as modifying the path statement to point to where the
latest version was installed, but that appears not to have been enough.  To
avoid further confusion, I'm uninstalling both versions and reinstalling
the latest now so as to reset the file associations which have become a
little out of sorts from all my tampering.

Thanks for helping me get to the heart of it!

--Greg
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python - print function - invalid syntax

2014-08-05 Thread Maxime Steisel
Le 2014-08-05 02:07, Greg Markham greg.mark...@gmail.com a écrit:
  Ok, when I try this from the Shell window, it works.  When executing the
full program from command line, it does not.  Python versions from both
shell and command line are 3.4.1 (confirmed via command: python -V).

 Full error msg output when run from cmd line reads:

   File I:\Programming\Scripts\Learning\chapter02\game_over2.py, line 14

 print(Here, end= )
  ^
 SyntaxError: invalid syntax


That definitely show that python2 is running.

I think this is because on windows, *.py files are associated with py.exe
that choose the python version depending on the first line of your file.
Putting #!python3 on the first line of game_over2.py should solve it.

See PEP 397 [1] for more details about this feature.

[1] http://legacy.python.org/dev/peps/pep-0397/
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python - print function - invalid syntax

2014-08-05 Thread Ben Finney
Greg Markham greg.mark...@gmail.com writes:

 For cmd line, yes that's basically it. When I say shell, I'm
 referring to the Python IDLE GUI.

For future reference: the operating system shell presents a command
line. The Python shell presents a command line. So “shell” and “command
line” don't distinguish between those.

You might better use the terms “operating system shell” (“OS shell”) and
“Python shell”.

Hope that helps.

-- 
 \   “Never express yourself more clearly than you are able to |
  `\   think.” —Niels Bohr |
_o__)  |
Ben Finney

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python - print function - invalid syntax

2014-08-05 Thread Marc Tompkins
On Tue, Aug 5, 2014 at 12:48 AM, Maxime Steisel maximestei...@gmail.com wrote:
 I think this is because on windows, *.py files are associated with py.exe
 that choose the python version depending on the first line of your file.

No.  *ix operating systems (Unix, Linux, OS X, etc.) inspect the first
line of a file to determine how to handle it; Windows does NOT.
Windows simply looks at the filename extension (.py, .pyw, etc.) and
consults its internal registry of file type associations.  The way
that you, as a user, can edit those associations has changed over the
years; in Windows 7 and 8, it's Control Panel\All Control Panel
Items\Default Programs\Set Associations.

On the other hand, when you start up CMD.EXE and type python at the
prompt, Windows uses a procedure that goes back to DOS 2 or so: the
PATH environment variable.  This is similar to, but a little different
from, the way that *ixes work; Windows first compares what you've
typed with the list of commands built-in to CMD, then with all of the
executable files in the current working directory, THEN
walks through the directories listed in PATH.  The first matching
command or executable it finds is the one that runs.

 Putting #!python3 on the first line of game_over2.py should solve it.
NO.  #! has no effect in Windows, because the choice of Python
interpreter has already been made by the time anybody gets round to
reading the first line of the file.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python - print function - invalid syntax

2014-08-05 Thread Mark Lawrence

On 05/08/2014 15:56, Marc Tompkins wrote:

On Tue, Aug 5, 2014 at 12:48 AM, Maxime Steisel maximestei...@gmail.com wrote:

I think this is because on windows, *.py files are associated with py.exe
that choose the python version depending on the first line of your file.


No.  *ix operating systems (Unix, Linux, OS X, etc.) inspect the first
line of a file to determine how to handle it; Windows does NOT.
Windows simply looks at the filename extension (.py, .pyw, etc.) and
consults its internal registry of file type associations.  The way
that you, as a user, can edit those associations has changed over the
years; in Windows 7 and 8, it's Control Panel\All Control Panel
Items\Default Programs\Set Associations.

On the other hand, when you start up CMD.EXE and type python at the
prompt, Windows uses a procedure that goes back to DOS 2 or so: the
PATH environment variable.  This is similar to, but a little different
from, the way that *ixes work; Windows first compares what you've
typed with the list of commands built-in to CMD, then with all of the
executable files in the current working directory, THEN
walks through the directories listed in PATH.  The first matching
command or executable it finds is the one that runs.


Putting #!python3 on the first line of game_over2.py should solve it.

NO.  #! has no effect in Windows, because the choice of Python
interpreter has already been made by the time anybody gets round to
reading the first line of the file.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor



Completely wrong, the reference that Maxime gave to PEP 397 that you've 
snipped was absolutely correct.  Windows might not handle shebang lines, 
Python on Windows does.


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python - print function - invalid syntax

2014-08-05 Thread Zachary Ware
On Tue, Aug 5, 2014 at 9:56 AM, Marc Tompkins marc.tompk...@gmail.com wrote:
 On Tue, Aug 5, 2014 at 12:48 AM, Maxime Steisel maximestei...@gmail.com 
 wrote:
 I think this is because on windows, *.py files are associated with py.exe
 that choose the python version depending on the first line of your file.

 No.  *ix operating systems (Unix, Linux, OS X, etc.) inspect the first
 line of a file to determine how to handle it; Windows does NOT.

Have a look at PEP 397[1].  You are correct, *Windows* does not look
at the shebang line.  However, Maxime is also correct in that Python
3.3+ installs the Python Launcher for Windows (py.exe) and associates
the .py extension with it, and *py.exe* does shebang line handling,
spawning the interpreter requested by the shebang line as a
subprocess.

 Windows simply looks at the filename extension (.py, .pyw, etc.) and
 consults its internal registry of file type associations.  The way
 that you, as a user, can edit those associations has changed over the
 years; in Windows 7 and 8, it's Control Panel\All Control Panel
 Items\Default Programs\Set Associations.

 On the other hand, when you start up CMD.EXE and type python at the
 prompt, Windows uses a procedure that goes back to DOS 2 or so: the
 PATH environment variable.  This is similar to, but a little different
 from, the way that *ixes work; Windows first compares what you've
 typed with the list of commands built-in to CMD, then with all of the
 executable files in the current working directory, THEN
 walks through the directories listed in PATH.  The first matching
 command or executable it finds is the one that runs.

 Putting #!python3 on the first line of game_over2.py should solve it.
 NO.  #! has no effect in Windows, because the choice of Python
 interpreter has already been made by the time anybody gets round to
 reading the first line of the file.

#!python3.4 or #!C:\Python34\python.exe or #!/usr/bin/env
python3 should all work if the '.py' extension is properly associated
with the py.exe launcher, which it should be if the most recently
installed Python was 3.3 or 3.4, installed with default options.

-- 
Zach

[1] http://legacy.python.org/dev/peps/pep-0397/
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python - print function - invalid syntax

2014-08-05 Thread Marc Tompkins
On Tue, Aug 5, 2014 at 8:23 AM, Zachary Ware
zachary.ware+py...@gmail.com wrote:

 which it should be if the most recently
 installed Python was 3.3 or 3.4, installed with default options.


And there we have my problem with this glorious new feature.  YOU
CAN'T RELY ON IT, because it depends on the most recent version having
been installed most recently.  Much better to depend on the underlying
behavior of the operating system.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python - print function - invalid syntax

2014-08-05 Thread Dave Angel
Marc Tompkins marc.tompk...@gmail.com Wrote in message:
 On Tue, Aug 5, 2014 at 8:23 AM, Zachary Ware
 zachary.ware+py...@gmail.com wrote:

 which it should be if the most recently
 installed Python was 3.3 or 3.4, installed with default options.

 
 And there we have my problem with this glorious new feature.  YOU
 CAN'T RELY ON IT, because it depends on the most recent version having
 been installed most recently.  Much better to depend on the underlying
 behavior of the operating system.
 

Read some more. Once you've got py.exe installed,  whether from
 python 3.3+ or manually, then you just point the path and/or file
 associations at it.  That's done by default when python 3.3+ is
 installed, and only messed up when you subsequently install an
 older version using the wrong options. 



-- 
DaveA

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python - print function - invalid syntax

2014-08-04 Thread Joel Goldstick
On Mon, Aug 4, 2014 at 1:28 PM, Greg Markham greg.mark...@gmail.com wrote:
 Hello,

 I'm extremely new to Python having only just started learning this week.
 I'm slowly plodding through a book, Python Programming for the Absolute
 Beginner, 3rd ed by Michael Dawson.

 Code is provided for all the scripts found throughout the book (found here),
 but I'm running into a syntax error when running one of the unmodified
 programs.  On line 14, which reads:

 print(Here, end= )

 I'm receiving a syntax error which points to the end parameter.  In order to
 confirm this, I modified the code to read:

 print(Here )

 ...which runs without incident.  My best guess is that there's a minor
 difference between the version of Python I'm using (3.4.1) and that which
 was in use at the time the book was written (3.1.x) that is responsible for
 this error.

Welcome to the group.  I think you made a typo.  Your code should run.
I just tried this:
 print(hi, end= )
hi 

A couple of things that will make it easier to help:

1. send mail as plain text.  Rich text causes some readers problems
2. copy and paste the code and complete traceback.  retyping things
make it more likely that what is in your code isn't exactly what you
typed


 Thanks and my apologies for the greenness of this question.

No apologies necessary -- ask away

 Sincerely,

 Greg

 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 https://mail.python.org/mailman/listinfo/tutor




-- 
Joel Goldstick
http://joelgoldstick.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python - print function - invalid syntax

2014-08-04 Thread Danny Yoo
  but I'm running into a syntax error when running one of the unmodified
  programs.  On line 14, which reads:
 
  print(Here, end= )
 
  I'm receiving a syntax error which points to the end parameter.

I'd like to also support Joel's suggestion to provide detailed output of
the error message.  It will help.

  difference between the version of Python I'm using (3.4.1) and that
which
  was in use at the time the book was written (3.1.x) that is responsible
for
  this error.

Just to double check: how are you confirming what version of Python you're
using?

Best of wishes!
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python - print function - invalid syntax

2014-08-04 Thread Cameron Simpson

On 04Aug2014 13:38, Danny Yoo d...@hashcollision.org wrote:

 difference between the version of Python I'm using (3.4.1) and that which
 was in use at the time the book was written (3.1.x) that is responsible
 for this error.


Just to double check: how are you confirming what version of Python you're
using?


In particular, Python 2 will produce a syntax error for your print statement; 
Python 3 should work.


Show a short transcript which also shows your ptyhon version.

Example:

$ python
Python 2.7.8 (default, Jul 13 2014, 17:11:32)
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
Type help, copyright, credits or license for more information.
 print(hi, end= )
  File stdin, line 1
print(hi, end= )
   ^
SyntaxError: invalid syntax

Versus:

$ python3.4
Python 3.4.1 (default, May 21 2014, 01:39:38)
[GCC 4.2.1 Compatible Apple LLVM 5.1 (clang-503.0.40)] on darwin
Type help, copyright, credits or license for more information.
 print(hi, end= )
hi 

The $ is my prompt.

Any Python 3 should accept your print() call.

The default system python on most platforms is still Python 2; that may be 
misleading you. In particular, if you're running a script you may need to 
ensure it is run with the correct Python version.


It is perfectly fine to have multiple Python versions installed, BTW. Just make 
sure you're using what you intend.


Cheers,
Cameron Simpson c...@zip.com.au
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python - print function - invalid syntax

2014-08-04 Thread Greg Markham
On Mon, Aug 4, 2014 at 12:37 PM, Alex Kleider aklei...@sonic.net wrote:

 On 2014-08-04 10:28, Greg Markham wrote:

 Hello,

 I'm extremely new to Python having only just started learning this week.
 I'm slowly plodding through a book, Python Programming for the Absolute
 Beginner, 3rd ed
 http://www.amazon.com/Python-Programming-Absolute-Beginner-
 Edition/dp/1435455002/ref=sr_1_5?ie=UTF8qid=1407049249sr=
 8-5keywords=learning+python

 by Michael Dawson.

 Code is provided for all the scripts found throughout the book (found here
 http://www.delmarlearning.com/companions/content/
 1435455002/downloads/py3e_source.zip),

 but I'm running into a syntax error when running one of the unmodified
 programs.  On line 14, which reads:

 *print(Here, end= )*

 try

 print(Here, end=)

 (no space between the quotes)
 The end parameter defaults to newline.
 If you change it to the empty string, there'll be no output of a newline
 character.


As I understand it, newline is inferred unless the end parameter is
used.  This program is designed merely to illustrate the flexibility of the
print function.  As you'll see below, the output from the line in which I
was receiving an error is intended to read as, Here it is...  For
clarity, the full program reads as follows:


# Game Over - Version 2
# Demonstrates the use of quotes in strings
# Python Programming for the Absolute Beginner, 3rd ed - Ch 2
# Greg Markham - Aug 04, 2014

print(Program 'Game Over' 2.0)

print(Same, message, as before)

print(Just,
  a bit,
  bigger)

print(Here, end= )
print(it is...)

print(

 _   ___   ___  ___   _
/  ___| /   | /   |/   | |  ___|
| |/ /| |/ /|   /| | | |__
| |  _/ ___ |   / / |__/ | | |  __|
| |_| |  / /  | |  / /   | | | |___
\_/ /_/   |_| /_/|_| |_|

 _   _ _   _   _
/  _  \ | |   / / |  ___| |  _  \
| | | | | |  / /  | |__   | |_| |
| | | | | | / /   |  __|  |  _  /
| |_| | | |/ /| |___  | | \ \
\_/ |___/ |_| |_|  \_\


 )

input(\n\nPress the enter key to exit.)
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python - print function - invalid syntax

2014-08-04 Thread Greg Markham
On Mon, Aug 4, 2014 at 11:52 AM, Joel Goldstick joel.goldst...@gmail.com
wrote:

 On Mon, Aug 4, 2014 at 1:28 PM, Greg Markham greg.mark...@gmail.com
 wrote:
  Hello,
 
  I'm extremely new to Python having only just started learning this week.
  I'm slowly plodding through a book, Python Programming for the Absolute
  Beginner, 3rd ed by Michael Dawson.
 
  Code is provided for all the scripts found throughout the book (found
 here),
  but I'm running into a syntax error when running one of the unmodified
  programs.  On line 14, which reads:
 
  print(Here, end= )
 
  I'm receiving a syntax error which points to the end parameter.  In
 order to
  confirm this, I modified the code to read:
 
  print(Here )
 
  ...which runs without incident.  My best guess is that there's a minor
  difference between the version of Python I'm using (3.4.1) and that which
  was in use at the time the book was written (3.1.x) that is responsible
 for
  this error.

 Welcome to the group.  I think you made a typo.  Your code should run.
 I just tried this:
  print(hi, end= )
 hi 


 Ok, when I try this from the Shell window, it works.  When executing the
full program from command line, it does not.  Python versions from both
shell and command line are 3.4.1 (confirmed via command: python -V).

Full error msg output when run from cmd line reads:

  File I:\Programming\Scripts\Learning\chapter02\game_over2.py, line 14
print(Here, end= )
 ^
SyntaxError: invalid syntax

A couple of things that will make it easier to help:

 1. send mail as plain text.  Rich text causes some readers problems


Thanks for the tip.  I'll keep this in mind for future queries  replies.


 2. copy and paste the code and complete traceback.  retyping things
 make it more likely that what is in your code isn't exactly what you
 typed


Apologies, but what is a traceback?  Is this a debugging feature found in
the shell?  (I looked, but didn't see it)

Thanks,

Greg
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python - print function - invalid syntax

2014-08-04 Thread Alan Gauld

On 05/08/14 00:21, Greg Markham wrote:


but I'm running into a syntax error


As others have said you are getting the expected error when running 
Python v3 code under Python v2.


How exactly are you running the program? It looks like somehow you
are picking up Python v2 when you run the script even though your python 
-V is showing v3.


BTW. Which OS are you using? It shouldn't affect the cause but
it helps with the debugging!


For clarity, the full program reads as follows:


# Game Over - Version 2
# Demonstrates the use of quotes in strings
# Python Programming for the Absolute Beginner, 3rd ed - Ch 2
# Greg Markham - Aug 04, 2014

print(Program 'Game Over' 2.0)

print(Same, message, as before)

print(Just,
   a bit,
   bigger)


Does all of the above print out correctly? Can you send
us a cut n paste of the exact output of the program?




print(Here, end= )
print(it is...)

print(
 
  _   ___   ___  ___   _
 /  ___| /   | /   |/   | |  ___|
 | |/ /| |/ /|   /| | | |__
 | |  _/ ___ |   / / |__/ | | |  __|
 | |_| |  / /  | |  / /   | | | |___
 \_/ /_/   |_| /_/|_| |_|

  _   _ _   _   _
 /  _  \ | |   / / |  ___| |  _  \
 | | | | | |  / /  | |__   | |_| |
 | | | | | | / /   |  __|  |  _  /
 | |_| | | |/ /| |___  | | \ \
 \_/ |___/ |_| |_|  \_\

 
  )

input(\n\nPress the enter key to exit.)


finally you could try putting the following at the very top of your program:

import sys
print(sys.version)

That will definitively prove that you are actually
running v3 on the file...

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python - print function - invalid syntax

2014-08-04 Thread Steven D'Aprano
On Mon, Aug 04, 2014 at 04:44:46PM -0700, Greg Markham wrote:

  Ok, when I try this from the Shell window, it works.  When executing the
 full program from command line, it does not.  Python versions from both
 shell and command line are 3.4.1 (confirmed via command: python -V).

I'm a little confused, because I consider the shell and command line 
to more or less be synonymous. Perhaps if you explain step-by-step what 
you do. Here's my guess of what you mean by command line:

Click on Start Menu.
Choose Run command.
Enter cmd.exe
Enter python I:\Programming\Scripts\Learning\chapter02\game_over2.py

Am I close?

 Full error msg output when run from cmd line reads:
 
   File I:\Programming\Scripts\Learning\chapter02\game_over2.py, line 14
 print(Here, end= )
  ^
 SyntaxError: invalid syntax

That definitely looks like a Python 2 error, but it should work in any 
version of Python 3. This is a most perplexing error, I can only imagine 
that you have both Python 2 and 3 installed and somehow, for some 
unknown reason, you're sometimes getting one and sometimes getting the 
other.


  2. copy and paste the code and complete traceback.  retyping things
  make it more likely that what is in your code isn't exactly what you
  typed
 
 
 Apologies, but what is a traceback?  Is this a debugging feature found in
 the shell?  (I looked, but didn't see it)

A traceback is the text Python prints when an error occurs. It normally 
starts with the word Traceback and ends with the kind of error 
(SyntaxError, NameError, ImportError, etc.) and usually an error 
message. For example:

Traceback (most recent call last):
  File stdin, line 1, in module
  File stdin, line 2, in function
TypeError: object of type 'int' has no len()

or similar. The details will differ slightly (e.g. sometimes Python can 
print the offending lines of code) but the important thing is that there 
is a lot of useful information available in the traceback, if you show 
us the entire thing, from start to finish.

SyntaxError is quite exceptional, in that it normally doesn't start with 
the word Traceback, for technical reasons[1]. Technically, I suppose, 
it's not really a traceback, but we tend to call it such regardless.






[1] SyntaxError normally occurs at compile-time, while Python is parsing 
the source code, and before execution starts, so there's no chain of 
calling functions and no traceback. But we normally don't care about the 
technical details.


-- 
Steven
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python

2014-05-04 Thread Jordan Smallwood
I never got a response. Should I check my spam?

Sent from my iPhone

 On Apr 28, 2014, at 1:57 AM, Mark Lawrence breamore...@yahoo.co.uk wrote:
 
 On 26/04/2014 23:53, jordan smallwood wrote:
 Hello,
 
 I am new to Python. I mean completely new and we're working on this
 problem set in class where they give us specs and we have to build
 something based off these specs. I have no idea what they're asking.
 Could someone help get me started on the path to figuring this out?
 
 Below is the question:
 
 1. Write a program module with at least two functions. Follow this
 specifi- cation exactly for these two functions:
 
 1.
(a)  One function, CalculateCentimeters, receives a value in inches
and returns the equivalent value in centimeters.
centimeters =2.54×inches
 2.
(b)  The other function, CalculateInches receives a value in centime-
ters and returns the equivalent value in inches. inches
=centimeters/2.54
 
 ... but you don’t 2.54 in your code 2 times. It’s a good candidate to be
 a module-level constant.
 Specified instructions about the internals of code, i.e., the names of
 your functions and how they behave, is called theinternal specification.
 It tells you, the author of the function, as well as programmers who
 call your function, how to call it and what to expect when it is called.
 You must following them exactly or call a meeting of your programming
 team because your choices here affect the others.
 For this exercise, you design the rest of the functions for your
 program, but be careful to keep all the code in functions.
 Invent and arrange functions as you wish to ask the user for:
 (a) a value
 (b) a unit of measure
 and call the appropriate function to print out the value in the other
 unit of measure.
 
 Specified instructions about the user’s view of your code (like just
 given) is called the external specification. Often the paying customer
 gives these directions so you must follow them exactly, doing things in
 the order given; but in this case, the internal design is up to you.
 
 What did you not understand about the answers you received to your original 
 question Help with an assignment?  Or if you could not be bothered to reply 
 to either Alan Gauld or Dave Angel, why should we now waste our time 
 attempting to help you?
 
 -- 
 My fellow Pythonistas, ask not what our language can do for you, ask what you 
 can do for our language.
 
 Mark Lawrence
 
 ---
 This email is free from viruses and malware because avast! Antivirus 
 protection is active.
 http://www.avast.com
 
 
 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 https://mail.python.org/mailman/listinfo/tutor
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python

2014-05-04 Thread Alan Gauld

On 28/04/14 13:56, Jordan Smallwood wrote:

I never got a response. Should I check my spam?


Probably, although Dave and I both basically said the same as the 
current batch of answers. Namely the exercise is pretty clear:

write a module with 2 functions.

Now, what part of that specifically do you not understand?

--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python

2014-04-28 Thread Mark Lawrence

On 26/04/2014 23:53, jordan smallwood wrote:

Hello,

I am new to Python. I mean completely new and we're working on this
problem set in class where they give us specs and we have to build
something based off these specs. I have no idea what they're asking.
Could someone help get me started on the path to figuring this out?

Below is the question:

1. Write a program module with at least two functions. Follow this
specifi- cation exactly for these two functions:

 1.
(a)  One function, CalculateCentimeters, receives a value in inches
and returns the equivalent value in centimeters.
centimeters =2.54×inches
 2.
(b)  The other function, CalculateInches receives a value in centime-
ters and returns the equivalent value in inches. inches
=centimeters/2.54

... but you don’t 2.54 in your code 2 times. It’s a good candidate to be
a module-level constant.
Specified instructions about the internals of code, i.e., the names of
your functions and how they behave, is called theinternal specification.
It tells you, the author of the function, as well as programmers who
call your function, how to call it and what to expect when it is called.
You must following them exactly or call a meeting of your programming
team because your choices here affect the others.
For this exercise, you design the rest of the functions for your
program, but be careful to keep all the code in functions.
Invent and arrange functions as you wish to ask the user for:
(a) a value
(b) a unit of measure
and call the appropriate function to print out the value in the other
unit of measure.

Specified instructions about the user’s view of your code (like just
given) is called the external specification. Often the paying customer
gives these directions so you must follow them exactly, doing things in
the order given; but in this case, the internal design is up to you.



What did you not understand about the answers you received to your 
original question Help with an assignment?  Or if you could not be 
bothered to reply to either Alan Gauld or Dave Angel, why should we now 
waste our time attempting to help you?


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

---
This email is free from viruses and malware because avast! Antivirus protection 
is active.
http://www.avast.com


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python

2014-04-28 Thread R. Alan Monroe
 1. Write a program module with at least two functions.

Hint: def is the Python keyword used to define a function. You can
read all about def in the docs on python.org.

Alan

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python

2014-04-28 Thread Danny Yoo
Hi Jordan,

You probably want to read up to chapter 3 (including the Functions
chapter) in How to Think Like a Computer Scientist:

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

or some equivalent tutorial, so that you at least know what the terms
in the problem statement means.  In particular, you'll want a very
concrete idea of what a _function_ is, because this assignment is all
how to write and use functions.  That's the core takeaway from the
problem, so learn about functions.


Are you using a particular book or material in your learning?  If so,
mention that.  Maybe one of us here has also read the same book and
can point out things for you to look at.

Also are there particular terms in the problem statement that are
confusing?  If so, point them out, and one of us here on Tutor can
probably help.


Personally, I would actually treat this problem in at least two steps.
 You don't have to get your whole program perfect the first time.  The
first paragraph which says Write a program module... up to the
description talking about CalculateInches().  But I would not
initially follow any of the paragraph material after ... but you
don't  Get the two functions working first.  Learn how to test
and run those functions first.  If you have questions on how to do so,
ask.

Ignore the advice about module level constants _until_ you've got the
functions working ok.  You'll be a better position to improve your
solution to fit the final approach.


Good luck to you!
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python

2014-04-28 Thread Steven D'Aprano
On Sat, Apr 26, 2014 at 03:53:33PM -0700, jordan smallwood wrote:
 Hello,
 
 I am new to Python. I mean completely new and we're working on this 
 problem set in class where they give us specs and we have to build 
 something based off these specs. I have no idea what they're asking. 
 Could someone help get me started on the path to figuring this out?

Yes. You need to write two functions, one to convert from inches to 
centimetres and one from centimetres to inches. You've learned about 
functions in maths class, I expect. This is similar.

Here's how you write functions in Python.

def double(x):
Return double x.
return 2*x

def half_plus_one(x):
Return half of x, plus 1.
return x/2.0 + 1


The keyword def starts the definition of the function. It is followed 
by the name of the function, then inside round brackets (parentheses) is 
a list of the arguments that the function requires. In my examples, the 
function only takes one argument, x, which you can assume is a number. 
If possible, you should use a more descriptive name than x.

The next line, a string starting and ending with THREE quotation marks, 
is called a doc string. It's just a short comment explaining what the 
function does. (It's also optional, but recommended.)

Inside the function, all your code needs to be indented by one level. 
You should indent by either:

Four spaces (this is recommended)
One Tab (if you must)

although any number of spaces is allowed, so long as it is consistent. 
Whatever you use, pick one, and use it for all indentation. Python will 
complain, or worse, do the wrong thing, if you have inconsistent 
indentation. (Say, four spaces on one line, then three on the next.)

Both my functions are simple enough that I only have a single line. The 
keyword return tells Python what value should be returned. It should, 
I hope, be obvious that 2*x gives two times x.

Is that enough to get you started?



-- 
Steven
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python - simple question

2012-11-30 Thread Unaiza Ahsan
I'm on Chapter 1 of Solem's book. The following function definition needs
to be added to imtools.py: [I did paste this I think in my first email].

import os
from numpy import *

def histeq(im,nbr_bins=256):
 Histogram equalization of a grayscale image. 
# get image histogram
imhist,bins = histogram(im.flatten(),nbr_bins,normed=True)
cdf = imhist.cumsum() # cumulative distribution function
cdf = 255 * cdf / cdf[-1] # normalize
# use linear interpolation of cdf to find new pixel values
im2 = interp(im.flatten(),bins[:-1],cdf)
return im2.reshape(im.shape), cdf


Now this file is saved as imtools.py in my main C:\Python27 folder.

In IDLE, I'm supposed to write:

from PIL import Image
from numpy import *
im = array(Image.open(’AquaTermi_lowcontrast.jpg’).convert(’L’))
im2,cdf = imtools.histeq(im)

That's it. That's the code I'm using. But it's giving me that error that
histogram is not found.

Er, I just checked the numpy version I have downloaded. It indeed doesn't
have any histogram (although its documentation says it should :s). Sorry. I
had checked the documentation first (and thought that this version contains
histogram).

I think the function histogram is not defined in numpy at all. It's in
something called mahotas (No idea what that is).

Thanks all for the help.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python - simple question

2012-11-19 Thread Unaiza Ahsan
* Where is the histogram() function from? Is it in imtools.py as well?
*
It is a NumPY function.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python - simple question

2012-11-19 Thread Unaiza Ahsan
*Hi all,

The function histogram is supposed to come from the numpy module; at* *
least that's the case on my computer (I have numpy 1.6.2 for Python
2.7):

 from numpy import ** *
 histogram
function histogram at 0x10b0c0ed8

Maybe something is wrong with Unaiza's version of numpy.* *

Kal

*Yes it's supposed to come from numpy. In imtools.py, the following line is
there:
from numpy import *

But I'm still getting the error. Since I'm a beginner in Python, I'm not at
all sure what's wrong here.

Thanks for the pointers/help.
Unaiza
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python - simple question

2012-11-19 Thread Oscar Benjamin
On 18 November 2012 14:07, Unaiza Ahsan unaiza.ah...@gmail.com wrote:
 Hi all,


 The function histogram is supposed to come from the numpy module; at

 least that's the case on my computer (I have numpy 1.6.2 for Python
 2.7):

 from numpy import *

 histogram
 function histogram at 0x10b0c0ed8

 Maybe something is wrong with Unaiza's version of numpy.


 Kal

 Yes it's supposed to come from numpy. In imtools.py, the following line is
 there:
 from numpy import *

 But I'm still getting the error. Since I'm a beginner in Python, I'm not at
 all sure what's wrong here.

I've checked and I also have a histogram function in my numpy module
so I don't understand what the problem is.

What would make it possible for us to help you, Unaiza, is if you
provide a short piece of code that demonstrates the problem you are
having. Perhaps you could just post the whole of the code you are
using but if you are able to shorten it while still demonstrating the
problem then that is better.

Reading the link below will help you to seek help from others. In
particular I don't have enough information to check if your code would
work on my computer or not, so it's difficult for me to help you right
now:
http://sscce.org/

The ideal thing would be if you could make a single Python script that
shows the problem you are having. If that is not possible then please
provide complete code and also as much as possible information about
how you are running your script, what folder it's in and what other
modules are in the folder and so on (more information is usually
better).


Oscar
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python - simple question

2012-11-18 Thread ALAN GAULD

 And the relevant portion in imtools.py is:
 def histeq(im,nbr_bins=256):
       Histogram equalization of a grayscale image. 

      #get image histogram
      imhist,bins = histogram(im.flatten(),nbr_bins,normed=True)


 This is the call, but where is histogram? If it is in imtools are you sure

The function histogram is supposed to come from the numpy module; at
least that's the case on my computer (I have numpy 1.6.2 for Python
2.7):

 from numpy import *
 histogram
function histogram at 0x10b0c0ed8

Maybe something is wrong with Unaiza's version of numpy.
More likely is that there is no import statement for numpy in imtools.py

Alan G.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python - simple question

2012-11-17 Thread staticsafe
On 11/16/2012 12:40, Unaiza Ahsan wrote:
 Hi all,
 
 I am following Jan Erik Solem's book Programming Computer Vision with
 Python and I'm just on the first chapter. The book asked us to create a
 file imtools.py and put down helpful functions there, which we can just
 call later.
 
 There is a function created for histogram equalization of images (called *
 histeq*), and saved in imtools.py. When I use this function and type this
 in IDLE:
 from PIL import Image
 from numpy import *
 im = array(Image.open('Tulips.jpg').convert('L'))
 im2,cdf = imtools.histeq(im)
 
 I get this:
 
 Traceback (most recent call last):
   File pyshell#59, line 1, in module
 im2,cdf = imtools.histeq(im)
   File C:\Python27\imtools.py, line 18, in histeq
 imhist,bins = histogram(im.flatten(),nbr_bins,normed=True)
 NameError: global name 'histogram' is not defined
 
 And the relevant portion in imtools.py is:
 def histeq(im,nbr_bins=256):
  Histogram equalization of a grayscale image. 
 
 #get image histogram
 imhist,bins = histogram(im.flatten(),nbr_bins,normed=True)
 cdf = imhist.cumsum() #Cumulative distribution function
 cdf = 255* cdf/cdf[-1] #Normalize
 
 #Use linear interpolation of cdf to find new pixel values
 im2 = interp(im.flatten(), bins[:-1],cdf)
 
 return im2.reshape(im.shape), cdf
 
 
 Can anybody point out where I'm going wrong? I have Python 2.7, NumPY,
 SciPY etc.
 
 Thanks very much
 
 Python Newbie!

Where is the histogram() function from? Is it in imtools.py as well?
-- 
staticsafe
O ascii ribbon campaign - stop html mail - www.asciiribbon.org
Please don't top post - http://goo.gl/YrmAb
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python - simple question

2012-11-17 Thread Alan Gauld

On 16/11/12 17:40, Unaiza Ahsan wrote:


There is a function created for histogram equalization of images (called
*histeq*), and saved in imtools.py.




from PIL import Image
from numpy import *
im = array(Image.open('Tulips.jpg').convert('L'))
im2,cdf = imtools.histeq(im)


I get this:

Traceback (most recent call last):
 im2,cdf = imtools.histeq(im)
   File C:\Python27\imtools.py, line 18, in histeq
 imhist,bins = histogram(im.flatten(),nbr_bins,normed=True)
NameError: global name 'histogram' is not defined


This tells us that the name histogram is not defined
in the imtools.py file. Is it one of the modules ytou show imported 
above? If so it will not be visible inside imtools.py. You need to 
import the required module in that file too.


But that's just a guess...


And the relevant portion in imtools.py is:
def histeq(im,nbr_bins=256):
  Histogram equalization of a grayscale image. 

 #get image histogram
 imhist,bins = histogram(im.flatten(),nbr_bins,normed=True)


This is the call, but where is histogram? If it is in imtools are you 
sure the spelling is correct? If its not there you need to import it 
from wherever it is defined.


HTH
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python - simple question

2012-11-17 Thread Kal Sze
On 18 November 2012 07:40, Alan Gauld alan.ga...@btinternet.com wrote:
 On 16/11/12 17:40, Unaiza Ahsan wrote:

 There is a function created for histogram equalization of images (called
 *histeq*), and saved in imtools.py.



 from PIL import Image
 from numpy import *
 im = array(Image.open('Tulips.jpg').convert('L'))
 im2,cdf = imtools.histeq(im)


 I get this:

 Traceback (most recent call last):
  im2,cdf = imtools.histeq(im)
File C:\Python27\imtools.py, line 18, in histeq
  imhist,bins = histogram(im.flatten(),nbr_bins,normed=True)
 NameError: global name 'histogram' is not defined


 This tells us that the name histogram is not defined
 in the imtools.py file. Is it one of the modules ytou show imported above?
 If so it will not be visible inside imtools.py. You need to import the
 required module in that file too.

 But that's just a guess...


 And the relevant portion in imtools.py is:
 def histeq(im,nbr_bins=256):
   Histogram equalization of a grayscale image. 

  #get image histogram
  imhist,bins = histogram(im.flatten(),nbr_bins,normed=True)


 This is the call, but where is histogram? If it is in imtools are you sure
 the spelling is correct? If its not there you need to import it from
 wherever it is defined.

 HTH
 --
 Alan G
 Author of the Learn to Program web site
 http://www.alan-g.me.uk/


 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor

Hi all,

The function histogram is supposed to come from the numpy module; at
least that's the case on my computer (I have numpy 1.6.2 for Python
2.7):

 from numpy import *
 histogram
function histogram at 0x10b0c0ed8

Maybe something is wrong with Unaiza's version of numpy.

Kal
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python

2012-05-18 Thread Steven D'Aprano

Hi Jeremy,

Welcome to Python, but please don't send HTML email (what some programs 
wrongly call Rich Text), as it completely destroys the necessary indentation 
of your Python code and makes it difficult or impossible to work out what your 
code is supposed to be.


However, I will take a wild guess as to what your problem is. You wrote:


I'm running this on mac 10.5.8. When I run this script from the command
line, there is no file output. However, if I remove the def statement in
the script and run again from the command line, a test.txt file is output.
I guess I'm trying to understand why using the def statement changes how
the script operates and since it does, how do I correct this code so it
runs from the command line with the def statement.


The def statement defines a function. The function doesn't run until you 
call it.


For example:

# Define a function.
def test():
print(Hello world)

# Nothing gets printed here, since the function is only defined,
# but not yet called.

# Now actually call it.
test()  # Take note that you need the round brackets () to call it.

Hello world will be printed.


Does that help?





--
Steven
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python

2012-05-18 Thread Vignesh Sathiamoorthy
Hi Jeremy,

I am new to Python too. I find docs.python.org very helpful.

*Understanding functions:*

http://docs.python.org/tutorial/controlflow.html#defining-functions

*Reading and Writing Files:*

http://docs.python.org/tutorial/inputoutput.html#reading-and-writing-files

*File Objects:*

http://docs.python.org/library/stdtypes.html#file-objects

*Comments - Coding Style*

http://www.python.org/dev/peps/pep-0008/#comments


Hope the above links are useful.

Thanks,
Vignesh

On Thu, May 17, 2012 at 11:45 PM, Jeremy Traurig
jeremy.trau...@gmail.comwrote:

 Hello,

 I very new to python and have been playing around with some simple code
 that I would eventually use in the real word. Below is the code I have
 created. I want the code to read data from a file called SIL633.txt and
 then output that data into another file called test.txt. below is my code:

 #! /usr/bin/env python
 # Read NRG Text File
 def readNRGtxt():
 import numpy as np
 f1 = open('SIL633_original.txt','r')
  data = np.genfromtxt(f1,delimiter='\t',skip_header=141)
 f1.close
 f2 = open('test.txt','w')
  np.savetxt(f2,data,fmt='%6.2f',delimiter='\t')
 f2.close

 I'm running this on mac 10.5.8. When I run this script from the command
 line, there is no file output. However, if I remove the def statement in
 the script and run again from the command line, a test.txt file is output.
 I guess I'm trying to understand why using the def statement changes how
 the script operates and since it does, how do I correct this code so it
 runs from the command line with the def statement.

 thanks for any help -- jeremy

 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python programing

2012-04-03 Thread Wayne Werner

On Mon, 2 Apr 2012, wesley chun wrote:


greetings walter, and welcome to the Python family!

snip

as far as books go, the best way to learn Python is by writing games.
this is an approach that works both with children as well as adults.
there are several excellent books that can help you with this regard:


There is another book that I didn't notice mentioned: Game Programming: The L 
line, the express
line to learning.

The book is unfortunately named because it makes no mention of Python, but it's
quite a good book for learning both programming and Python... and games!

Good luck and welcome to Python!
-Wayne Werner
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python programing

2012-04-03 Thread Christian Witts

On 2012/04/03 03:50 PM, Cranky Frankie wrote:

Another resourse for learning to program is YouTube. They just had a
segment on 60 Minutes about a guy who does all kinds of well
regarded free courses on-line, unfortunately I can't remberber the
URL. I've viewed several Stanford University programming courses, and
there are many Python specific vidoes there as well. Just something
else to check out.


Are you possibly thinking of the Khan Academy [1] ?

[1] http://www.khanacademy.org/
--

Christian Witts
Python Developer
//
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python programing

2012-04-03 Thread Cranky Frankie
On Tue, Apr 3, 2012 at 10:09 AM, Christian Witts cwi...@compuscan.co.za wrote:

 Are you possibly thinking of the Khan Academy [1] ?

 [1] http://www.khanacademy.org/

Yes, that was it, thanks.


-- 
Frank L. Cranky Frankie Palmeri
Risible Riding Raconteur  Writer
“The problem with quotes on the Internet is that
it is often difficult to verify their authenticity.”
- Abraham Lincoln
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python programing

2012-04-03 Thread Brad Hudson
 Are you possibly thinking of the Khan Academy [1] ?

 [1] http://www.khanacademy.org/

If you're interested in free courses, MIT also has free programming
courses (done in Python) via their OpenCourseWare and will be
expanding this to MITx in the near future.

OpenCourseWare - Intro to Computer Science  Programming (Python
based) located here:
http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-00sc-introduction-to-computer-science-and-programming-spring-2011/index.htm

Brad
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python programing

2012-04-03 Thread wesley chun
a couple of other sources of video learning (DISCLAIMER: the 1st is
from my employer, and the 2nd is from me -- the intention is to
provide alternatives not shameless self-promotion so please don't take
it that way!):

1. Google offers an internal Python training class to its employees.
it's a 2-day course designed to teach existing programmers how to code
in Python, covering syntax, data structures, etc. (it's not deep and
thorough like the course i teach publicly but it may be just what you
need.)

i volunteer to deliver it a couple of times a year. anyway, you can
get all the course contents, exercises, and a lively delivery by my
colleague Nick Parlante (recorded a few years ago) across 7 videos
which span both days here:
http://code.google.com/edu/languages/google-python-class

2. a few years ago, i was asked to do a video version of my public
course blended with material from the Core Python Programming book.
the primary target audience includes existing programmers who need to
learn Python (2.x  3.x) quickly and comprehensively via video
lectures (as opposed to the show-me-do style of onscreen hacking --
which is *also* a viable way of learning but just not for everyone).

some people prefer the lecture-style, so if you do, then you may wish
to consider it. i made the mistake of not being more public about this
early on, hence some of the not-so-great Amazon reviews. :P anyway, if
you're interested, you can get a free video clip here:
http://www.informit.com/store/product.aspx?isbn=9780137143412. (the
editors left some of my bleeping bloopers in the DVD, so it may be
entertaining to you at my expense.) another free preview of my
teaching style (if you want to learn about Python Generators) can be
found at http://cyberwebconsulting.com

cheers,
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
A computer never does what you want... only what you tell it.
    wesley chun : wescpy at gmail : @wescpy/+wescpy
    Python training  consulting : CyberwebConsulting.com
    Core Python books : CorePython.com
    Python blog: wescpy.blogspot.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python programing

2012-04-02 Thread Shane Keene
I don't currently use Python 3 and don't recommend that you use it to
learn with, mostly because the bulk of the docs and learning resources
are Python 2.x focused and the two are not compatible. That said, here
are some resources that you may find useful (particularly if you choose
to learn using 2.x):

Learn Python the Hard Way: http://learnpythonthehardway.org/

How to Think Like a Computer Scientist:
http://openbookproject.net/thinkcs/python/english2e/

and http://python.org/doc has a wealth of info as does
http://wiki.python.org/moin/BeginnersGuide/NonProgrammers

hope that's helpful.

On Mon, 2012-04-02 at 17:03 -0700, Walter Luna wrote:
 Hi everybody, my name is Walter I am a new beginner with no programing 
 experience. I am using OSX Lion, and successfully installed Python version 3. 
 I am looking for a programing guide for  beginners with no programing 
 experience. Can you please suggest me a good one to use. Thank you.
 
 Walter 
 ___
 Tutor maillist  -  Tutor@python.org
 To unsubscribe or change subscription options:
 http://mail.python.org/mailman/listinfo/tutor


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python programing

2012-04-02 Thread wesley chun
greetings walter, and welcome to the Python family!

it looks like you've got your machine all set up. hopefully installing
Python 3 wasn't too difficult -- users constantly have issues with
their own installs clash with the Python that's pre-installed by
Apple.

as far as learning Python for beginners goes, you have to decide what
version to learn -- since you have both Python 2  3 on your system,
you have a choice. if you have existing code that's written in Python
2.x, you should learn that first. if you have no baggage, then
Python 3.x is the way to go as it is the future.

regardless of which you pick, you should realize: 1) once you learn
one, you will learn the other as there are only seemingly minor (but
backwards-incompatible differences), 2) most books and online
materials are still in Python 2 although more and more Python 3
materials are becoming available.

as far as books go, the best way to learn Python is by writing games.
this is an approach that works both with children as well as adults.
there are several excellent books that can help you with this regard:

- Hello World! Computer Programming for Kids and Other Beginners by
Warren Sande and Carter Sande, Manning,
- Invent your Own Computer Games with Python second edition by Al Sweigart
- How to Think Like a Computer Scientist by Allen B. Downey, Jeff
Elkner and Chris Meyers, Green Tea Press
- Python Programming for the Absolute Beginner by Michael Dawson,
Course Technology

i go into a bit more detail on these as well as the books shane
recommends in my Python Reading List article (which actually
describes 3 separate reading lists):
http://www.informit.com/articles/article.aspx?p=1849069

as far as online resources go, try these:

- How to Think Like a Computer Scientist (Downey, Elkner, Meyers)
http://www.openbookproject.net/thinkcs/
- Learning to Program (Gauld)
http://www.alan-g.me.uk/l2p
- LiveWires Python
http://www.livewires.org.uk/python/home
http://pythongames.weebly.com/livewires.html
- Snake Wrangling for Kids (Briggs)
http://www.briggs.net.nz/snake-wrangling-for-kids.html
http://code.google.com/p/swfk/
- Computer Programming is Fun! (Handy)
http://www.handysoftware.com/cpif/
- Karel the Robot clone: Guido van Robot
http://gvr.sf.net
http://en.wikipedia.org/wiki/Guido_van_Robot
- Karel the Robot clones: RUR-PLE
http://rur-ple.sf.net
http://en.wikipedia.org/wiki/RUR-PLE
- A Byte of Python (Swaroop)
http://www.swaroopch.com/notes/Python
- Instant Hacking: Learning to Program with Python (Hetland)
http://hetland.org/writing/instant-hacking.html

hope this all helps, and again, welcome to Python!!
--wesley


On Mon, Apr 2, 2012 at 5:03 PM, Walter Luna wlun...@gmail.com wrote:
 Hi everybody, my name is Walter I am a new beginner with no programing 
 experience. I am using OSX Lion, and successfully installed Python version 3. 
 I am looking for a programing guide for  beginners with no programing 
 experience. Can you please suggest me a good one to use. Thank you.

 Walter


-- 
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
A computer never does what you want... only what you tell it.
    wesley chun : wescpy at gmail : @wescpy/+wescpy
    Python training  consulting : CyberwebConsulting.com
    Core Python books : CorePython.com
    Python blog: wescpy.blogspot.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] new to python

2010-11-19 Thread Alan Gauld


Alan Gauld alan.ga...@btinternet.com wrote 


COM = Common Object Model


Oops, sorry. 
That should be COMPONENT Object Model...


Alan G.

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] new to python

2010-11-19 Thread Walter Prins
On 19 November 2010 00:20, Joel Schwartz j...@joelschwartz.com wrote:

 For those of us who are new to writing code that makes various software
 packages interact with each other, can you say more about what COM object
 model means in this context and where one can learn how to use it to make
 Python interact with Excel and with Windows software in general. I've seen
 term COM before and I know it has something to do with how Windows
 programs interact with each other, but that's about it. Can you suggest some
 resources for learning more?


Sure, I'll just add to what Alan and Emile's already said.

The first thing (that's perhaps obvious but I'll just mention it explicitly)
about COM is that it was one of the earlier attempts at solving the
programming language and application interoperability problem.  E.g, how do
we write code so that other languages can easily consume our functionality,
and vice versa?  DDE was an early attempt by Microsoft at a solution, and
COM was an attempt by Microsoft's at a more comprehensive and general answer
to this.  It basically defines a set of standards and API's that effectively
can serve as a language-agnostic bridge between different programming
languages, if those languages are COM enabled by their supporting and
complying with COM's requirements.

An important extension or evolution of COM to networks was called DCOM (or
Distributed Component Object Model.)  As the name aludes, it extends COM
so that it can operate accross a network.  In other words, have a program on
one computer instantiate a component or object (possibly implemented in
another language) on another computer, and work with this object as if it's
a local object part of the lcoal program.   Depending on how well a language
supports and is integrated with COM/DCOM this may and should for the most
part even look like a local native object in the language being programmed
in.

DCOM eventually was further evolved into and eventually included under the
moniker of COM itself, and a set of extensions to DCOM that solved/addressed
a bunch of additional problems/concerns (like security and object pooling,
that you would have to deal with yourself when using only COM/DCOM that
typically occurs in the context of distributed applications) was then called
COM+.   (For more see http://ur.ly/v1Xy and http://ur.ly/v8Ii)

Anyway, suffice it to say, COM and friends introduces its own set of
downsides and issues (suffice it to say I've lost a not insignificant amount
of blood fighting with obscure DCOM security issues in the past), which
eventually was at least one of the reasons for Microsoft eventually coming
up with the .Net framework.  (.Net then, is at one level another attempt at
solving the language interoperability problem in a more seamless and elegant
way.  WSDL and web services standards were another, targetting the program
interoperability accross the web/internet at large, COM/DCOM originally
targetted local area networks and doesn't work very well or easily accross
the internet.)

As for resources, there's a seemingly decent presentation on Python and COM
and friends here: http://ur.ly/voQt

Also there's Activestate's documentation that's appropriate:
http://docs.activestate.com/activepython/2.5/pywin32/html/com/win32com/HTML/GeneratedSupport.html
http://docs.activestate.com/activepython/2.5/pywin32/html/com/win32com/HTML/QuickStartClientCom.html

The package that enables Python to interoperate with COM
applications/languages (as well as making available much of the Windows
Win32 API's as well as the PythonWin application) is called pywin32 and
is available here:
http://sourceforge.net/projects/pywin32/

While the Python package win32com which is included in pywin32 (which
enables Python to interoperate with COM applications/languages) provides a
number of ways of querying and accessing COM interfaces with few obvious
differences between them (provided you know the interface), it is usually
more convenient when experimenting to know what methods and properties are
really available for a given interface as well as being more efficient to
use so called early-binding when accessing COM objects. This is where the
makepy utility comes in. By selecting a particular type library and
building the Python wrappers using this tool in advance, more information
becomes available since you and Python can then refer to the generated
Python wrappers for casual investigation of object interfaces.  All of this
is also covered above in the ActiveState documentation as well as here:
http://oreilly.com/catalog/pythonwin32/chapter/ch12.html

Hopefully that clarifies things a bit. I would suggest you try install the
pywin32 package, then have a go at playing around with Excel perhaps
interactively at first, and then with the tools and examples as outlined in
some of the links I've posted.  (As an aside, obviously I've commented
mostly only on using Python as a COM client, it is also possible to write
COM servers in Python, 

Re: [Tutor] new to python

2010-11-19 Thread Joel Schwartz
Great information. Thanks to everyone who replied.
 
Joel


  _  

From: Walter Prins [mailto:wpr...@gmail.com] 
Sent: Friday, November 19, 2010 5:52 AM
To: Joel Schwartz
Cc: Tutor@python.org
Subject: Re: [Tutor] new to python




On 19 November 2010 00:20, Joel Schwartz j...@joelschwartz.com wrote:


For those of us who are new to writing code that makes various software
packages interact with each other, can you say more about what COM object
model means in this context and where one can learn how to use it to make
Python interact with Excel and with Windows software in general. I've seen
term COM before and I know it has something to do with how Windows
programs interact with each other, but that's about it. Can you suggest some
resources for learning more?



Sure, I'll just add to what Alan and Emile's already said. 

The first thing (that's perhaps obvious but I'll just mention it explicitly)
about COM is that it was one of the earlier attempts at solving the
programming language and application interoperability problem.  E.g, how do
we write code so that other languages can easily consume our functionality,
and vice versa?  DDE was an early attempt by Microsoft at a solution, and
COM was an attempt by Microsoft's at a more comprehensive and general answer
to this.  It basically defines a set of standards and API's that effectively
can serve as a language-agnostic bridge between different programming
languages, if those languages are COM enabled by their supporting and
complying with COM's requirements.  

An important extension or evolution of COM to networks was called DCOM (or
Distributed Component Object Model.)  As the name aludes, it extends COM
so that it can operate accross a network.  In other words, have a program on
one computer instantiate a component or object (possibly implemented in
another language) on another computer, and work with this object as if it's
a local object part of the lcoal program.   Depending on how well a language
supports and is integrated with COM/DCOM this may and should for the most
part even look like a local native object in the language being programmed
in.  

DCOM eventually was further evolved into and eventually included under the
moniker of COM itself, and a set of extensions to DCOM that solved/addressed
a bunch of additional problems/concerns (like security and object pooling,
that you would have to deal with yourself when using only COM/DCOM that
typically occurs in the context of distributed applications) was then called
COM+.   (For more see http://ur.ly/v1Xy and http://ur.ly/v8Ii)  

Anyway, suffice it to say, COM and friends introduces its own set of
downsides and issues (suffice it to say I've lost a not insignificant amount
of blood fighting with obscure DCOM security issues in the past), which
eventually was at least one of the reasons for Microsoft eventually coming
up with the .Net framework.  (.Net then, is at one level another attempt at
solving the language interoperability problem in a more seamless and elegant
way.  WSDL and web services standards were another, targetting the program
interoperability accross the web/internet at large, COM/DCOM originally
targetted local area networks and doesn't work very well or easily accross
the internet.)

As for resources, there's a seemingly decent presentation on Python and COM
and friends here: http://ur.ly/voQt

Also there's Activestate's documentation that's appropriate: 
http://docs.activestate.com/activepython/2.5/pywin32/html/com/win32com/HTML/
GeneratedSupport.html
http://docs.activestate.com/activepython/2.5/pywin32/html/com/win32com/HTML/
QuickStartClientCom.html

The package that enables Python to interoperate with COM
applications/languages (as well as making available much of the Windows
Win32 API's as well as the PythonWin application) is called pywin32 and
is available here:
http://sourceforge.net/projects/pywin32/

While the Python package win32com which is included in pywin32 (which
enables Python to interoperate with COM applications/languages) provides a
number of ways of querying and accessing COM interfaces with few obvious
differences between them (provided you know the interface), it is usually
more convenient when experimenting to know what methods and properties are
really available for a given interface as well as being more efficient to
use so called early-binding when accessing COM objects. This is where the
makepy utility comes in. By selecting a particular type library and
building the Python wrappers using this tool in advance, more information
becomes available since you and Python can then refer to the generated
Python wrappers for casual investigation of object interfaces.  All of this
is also covered above in the ActiveState documentation as well as here:
http://oreilly.com/catalog/pythonwin32/chapter/ch12.html

Hopefully that clarifies things a bit. I would suggest you try install the
pywin32 package, then have a go at playing around with Excel perhaps

Re: [Tutor] new to python

2010-11-18 Thread Steven D'Aprano

gary engstrom wrote:

Dear Python Tutor,

Being new to python I was wondering if there is a way to import exel data
into pyrhon matrix/arrays so that I have some data to work with. I know R
uses Rcmdr as an easy interface
for excel data, which helps keep the reader engaged while learning the
language.



Python doesn't directly support Excel binary formats such as xls, but it 
does support the interchange CSV format. See the csv module:


http://docs.python.org/library/csv.html
http://effbot.org/librarybook/csv.htm

Also, if you write your data to a tab-delimited file, you can just read 
the file line by line, splitting on tabs.


Finally, if you must deal with Excel binary formats, there is at least 
one third-party library that might help. Google for python excel for 
links.



--
Steven

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] new to python

2010-11-18 Thread Walter Prins
On 18 November 2010 21:13, gary engstrom engstrom.g...@gmail.com wrote:

 Being new to python I was wondering if there is a way to import exel data
 into pyrhon matrix/arrays so that I have some data to work with. I know R
 uses Rcmdr as an easy interface
 for excel data, which helps keep the reader engaged while learning the
 language.


If you want to read/write an Excel format files, have a look at the xlwt
and the xlrt Python modules (probably what Steven was aluding to). See
http://www.python-excel.org/

These modules works quite well for reading/generating Excel files (with
expectable limitations) from any platform that Python's available on (e.g.
including non-Windows) and thus does not require Excel to be available on
the machine you're producing the file on.

If however you are running on Windows and have Excel installed, you could
also consider driving the real Excel via COM automation, which will
guarantee you get desired results including formatting, charts etc when
generating sheets, and will ensure you have full access to all the
functionality Excel exposes via its COM object model.

If your requirements is simple enough though then Steven's suggestion to use
CSV is probably preferable, e.g. export the data to CSV and then import with
the csv module in Python.  (The KISS principle applies here as elsewhere
in programming: Keep It Small  Simple)

HTH,

Walter
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] new to python

2010-11-18 Thread Joel Schwartz
Walter,
 
For those of us who are new to writing code that makes various software
packages interact with each other, can you say more about what COM object
model means in this context and where one can learn how to use it to make
Python interact with Excel and with Windows software in general. I've seen
term COM before and I know it has something to do with how Windows
programs interact with each other, but that's about it. Can you suggest some
resources for learning more?

Thanks,
Joel

  _  

From: tutor-bounces+joel=joelschwartz@python.org
[mailto:tutor-bounces+joel=joelschwartz@python.org] On Behalf Of Walter
Prins
Sent: Thursday, November 18, 2010 2:51 PM
To: gary engstrom
Cc: Tutor@python.org
Subject: Re: [Tutor] new to python




On 18 November 2010 21:13, gary engstrom engstrom.g...@gmail.com wrote:


Being new to python I was wondering if there is a way to import exel data
into pyrhon matrix/arrays so that I have some data to work with. I know R
uses Rcmdr as an easy interface
for excel data, which helps keep the reader engaged while learning the
language.



If you want to read/write an Excel format files, have a look at the xlwt
and the xlrt Python modules (probably what Steven was aluding to). See
http://www.python-excel.org/  

These modules works quite well for reading/generating Excel files (with
expectable limitations) from any platform that Python's available on (e.g.
including non-Windows) and thus does not require Excel to be available on
the machine you're producing the file on.

If however you are running on Windows and have Excel installed, you could
also consider driving the real Excel via COM automation, which will
guarantee you get desired results including formatting, charts etc when
generating sheets, and will ensure you have full access to all the
functionality Excel exposes via its COM object model.

If your requirements is simple enough though then Steven's suggestion to use
CSV is probably preferable, e.g. export the data to CSV and then import with
the csv module in Python.  (The KISS principle applies here as elsewhere
in programming: Keep It Small  Simple)

HTH,

Walter

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] new to python

2010-11-18 Thread Alan Gauld


Joel Schwartz j...@joelschwartz.com wrote

packages interact with each other, can you say more about what COM 
object
model means in this context and where one can learn how to use it 
to make

Python interact with Excel and with Windows software in general.


COM = Common Object Model

It is a Microsoft standard to expose application Objects so that 
programs

can interact with each other by calling those objects methods. Because
it is a binary standard it will work with any programming language 
with

a COM binding.

Typically an office application will expose a Document object that you
can open, read, close etc.Excel includes operations to select tabs,
columns, rows, cells etc.

There have been numerous incarnations of COM over the years, you may
have also heard of OLE, ActiveX, DCOM, COM+ etc.

There is a load of info on the Microsoft Developers web site.
You can access COM via the Pythonwin library in the windows extensions
package and Marrk Hammond's book  Python Programming on Win32
provides extensive descriptions.

Personally I prefer to interact with COM via VBScript as the Python 
route

is (only slightly) more clunky. IMHO

HTH,


--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] new to python

2010-11-18 Thread Emile van Sebille

On 11/18/2010 4:20 PM Joel Schwartz said...

Walter,

For those of us who are new to writing code that makes various software
packages interact with each other, can you say more about what COM object
model means in this context and where one can learn how to use it to make
Python interact with Excel and with Windows software in general. I've seen
term COM before and I know it has something to do with how Windows
programs interact with each other, but that's about it. Can you suggest some
resources for learning more?



This looks like one appropriate starting point...

http://docs.activestate.com/activepython/2.4/pywin32/html/com/win32com/HTML/QuickStartServerCom.html

Emile

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python

2009-10-29 Thread asterix09

I am running Windows Vista. 

Do you know what remote desktop is? This is the tool I use to connect to my 
other severs on the network or alternatively I use my Run option (Start/Run) 
where you add in the IP address and connect to the server.

I want to use python to do this for me. I can do it with a batch file.

This is what I am looking to do.

I have a log file. In this log file contains the following text:

115=ABS
115=DRF
115=HSD

Lets call this log file A.

I am looking to run s script that will search this log file and take all the 
text after the = sign (ABS/DRF..etc) and paste that into another text file, 
call it text file B.

Once that it done I will need to compare other log files to file B and any new 
text after = that is not in the text file B must be added and anything that 
is must be ignored.

The goal is that in these log files there will be multiple different text for 
115=..etc. I need to create a list/mini database for them. So every day I need 
to run a script against a logfile to search for any new text.

Thanks


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python

2009-10-29 Thread Tim Golden

asteri...@petlover.com wrote:
I am running Windows Vista. 


OK. Definite points for giving useful info up front.


Do you know what remote desktop is? 


Yes.

This is the tool I use to connect to my other severs on 
the network or alternatively I use my Run option (Start/Run) 
where you add in the IP address and connect to the server.


Uh-oh; not so clear. There's quite a difference between rdp and
a file-server connection. But ok...

I want to use python to do this for me. 


To do *what* for you? Control a remote desktop? Start a
remote folder in explorer?


I can do it with a batch file.


Can you show us the batch file?



This is what I am looking to do.


[... snip stuff about a log file ...]

Have I missed something? What does this have to do with the
previous stuff about remote desktops and connecting to
servers?

I'm sorry, asterix09, I'm sure we're willing to help you,
but you seem to be confusing several things at once here.

I'm going to have a stab at what you're talking about and
let's see how close I get:

* You have several log files on some remote machines

* The log files contain lines of text of the form: aaa=bbb

* You want to perform some kind of comparison of this content, building
 up a database of some underspecified structure.

Am I close?

TJG
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python

2009-10-28 Thread Kent Johnson
Forwarding to the list with my reply (please use Reply All to reply to
the list):

On Wed, Oct 28, 2009 at 2:01 AM,  asteri...@petlover.com wrote:
 Hi Kent,

 Thank you for replying to my request, really appreciate it.

 I am not familiar with all your connections that you have mentioned below.

 What I can tell you which I hope can help is that I have a log file on a
 different server/machine on a network which I would like to copy and paste
 on my machine?

How would you copy the file if you did it by hand? Is the server file
system accessible to your machine? If so, you can copy it with
shutil.copyfile() or just open it and process it directly.

Kent
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python

2009-10-28 Thread Dave Angel




Remember to hit Reply to all

- Forwarding your message onto the list

-- Forwarded message --
From: asteri...@petlover.com
Date: Wed, Oct 28, 2009 at 1:00 AM
Subject: Re: [Tutor] New to Python
To: sri...@gmail.com


Hi Wayne,

I will try as best to explain what I need to do.

I have a log file. In that log file thre contains text. Something along the
lines of this.

115=WAS
115=GAD
115=TRE

I need to search that log file (thought of using grep) and write each text
after the = sign to another text file. So the other text file (call it *
List*) will contain a list of all the differernt values for 115.

After I have created that, i then need to run a script that will run through
the latest log file and compare the *List *from the log file and any new
115=... values that are not in the* List *text file must be added, vice
versa.

End result is that I want to track and see how many values I can get in the
115=...

The log file is siuated on a different server/machine on my network, so I
want the script to be able to copy the log file from the server to my
machine.

I hope that makes sense.

 Many thanks for your help.

-Original Message-
From: Wayne sri...@gmail.com
To: asteri...@petlover.com
Cc: tutor@python.org
Sent: Tue, Oct 27, 2009 6:53 pm
Subject: Re: [Tutor] New to Python

 On Tue, Oct 27, 2009 at 10:35 AM, asteri...@petlover.com wrote:

  

Hi there,

How do you connect to a different server using python? (I have not used
python before)




 What kind of server? What do you ultimately want to do?

 see:  http://catb.org/~esr/faqs/smart-questions.html#beprecise

 for more info about asking good questions. We can't help you if we don't
know what you want.
-Wayne


  

Did you look up the smart-questions url?

Since you're trying to connect from one Windows XP machine to another 
Windows XP or Server 2003 machine on the same network, the simplest 
answer is to use UNC names, which are machine-name, share-name, and 
path, all rolled into one string with two leading backslashes.


In that case, you can do an open something like the following:
 infile = open(r\\myserver\share3\system\logs\mylog.txt, r)

Notice the r which indicates a raw string, so you wouldn't need to 
double the backslashes.


DaveA

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python

2009-10-28 Thread asterix09

Well I would have to remote to the machine that contains the log file and copy 
it from there.


-Original Message-
From: Kent Johnson ken...@tds.net
To: asteri...@petlover.com
Cc: *tutor python tutor@python.org
Sent: Wed, Oct 28, 2009 1:18 pm
Subject: Re: [Tutor] New to Python



Forwarding to the list with my reply (please use Reply All to reply to
he list):
On Wed, Oct 28, 2009 at 2:01 AM,  asteri...@petlover.com wrote:
 Hi Kent,

 Thank you for replying to my request, really appreciate it.

 I am not familiar with all your connections that you have mentioned below.

 What I can tell you which I hope can help is that I have a log file on a
 different server/machine on a network which I would like to copy and paste
 on my machine?
How would you copy the file if you did it by hand? Is the server file
ystem accessible to your machine? If so, you can copy it with
hutil.copyfile() or just open it and process it directly.
Kent

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python

2009-10-28 Thread Kent Johnson
On Wed, Oct 28, 2009 at 11:16 AM,  asteri...@petlover.com wrote:
 Well I would have to remote to the machine that contains the log file and
 copy it from there.

You are not being very helpful. What does remote to the machine
mean? What OS are you running? Some details would help.

Kent

PS Please don't top-post.


 -Original Message-
 From: Kent Johnson ken...@tds.net
 To: asteri...@petlover.com
 Cc: *tutor python tutor@python.org
 Sent: Wed, Oct 28, 2009 1:18 pm
 Subject: Re: [Tutor] New to Python

 Forwarding to the list with my reply (please use Reply All to reply to
 the list):

 On Wed, Oct 28, 2009 at 2:01 AM,  asteri...@petlover.com wrote:
 Hi Kent,

 Thank you for replying to my request, really appreciate it.

 I am not familiar with all your connections that you have mentioned below.

 What I can tell you which I hope can help is that I have a log file on a
 different server/machine on a network which I would like to copy and paste
 on my machine?

 How would you copy the file if you did it by hand? Is the server file
 system accessible to your machine? If so, you can copy it with
 shutil.copyfile() or just open it and process it directly.

 Kent

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python

2009-10-27 Thread Wayne
On Tue, Oct 27, 2009 at 10:35 AM, asteri...@petlover.com wrote:

  Hi there,

 How do you connect to a different server using python? (I have not used
 python before)


What kind of server? What do you ultimately want to do?

see:  http://catb.org/~esr/faqs/smart-questions.html#beprecise

for more info about asking good questions. We can't help you if we don't
know what you want.
-Wayne
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python

2009-10-27 Thread Kent Johnson
On Tue, Oct 27, 2009 at 11:35 AM,  asteri...@petlover.com wrote:
 Hi there,

 How do you connect to a different server using python? (I have not used
 python before)

What kind of connection? The Python standard library includes modules
which support raw sockets, http, ftp, smtp, xml-rpc and probably a few
others. Paramiko is an add-on that supports ssh2 connection.

Kent
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python

2009-10-27 Thread Alan Gauld
asteri...@petlover.com wrote 

How do you connect to a different server using python? 
(I have not used python before)


Have you programmed before? If so in what languages?
If you are a complete novice any kind of network programming 
is quite a challenge. If you are experienced can you give us 
a bit more context?


--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python

2009-10-21 Thread Alan Gauld

lfsee...@comcast.net wrote


Just started looking at Python


Welcome to the list.

I was wondering if there was a Preset Menu and file system module 


Not really sure what you are expecting here?
Can you give examples of what you would expect these to do?
There are operations for acting on files, if thats what you mean.

So basically (pardon the pun), is there a good reference online 
for using the libariers to give me a simple Interface with 
pull downs and such, file system and so? 


If you mean a GUI then there are GUI toolkits for building user 
interfaces. If you mean an IDE then there is IDLE which comes 
as standard (and a whole bunch of others you can download).


I'm still not quite sure what you are expecting based on your 
description.


Last time I did any real coding had to write that myself, 
of course that was before many on the list was born I would guess. 


You still need to write your own GUI for your apps although you should 
find the tookits now are easier to use. Also there are a few graphical 
tools to help build GUIs although my own experience is that none of the 
Python ones are great.


So I need a site that can handhold be a bit til whats left in the 
little gray cells can start working. 


There are lots of tutorials around both for basic Python programming 
and for GUI building (depending on the toolkit - there are several)

If you just want a flavour you could look at the GUI topic in my tutorial.

The Issue that brings this up is I want to put together a program 
to help Miniature Wargame Players run mid to long campaign games, 
with all the wargames out there one would think there would be 
more than a few of these about, but there are very few and 
the better one still works like a DOS program. 


Batch oriented programs are often best driven by a command line 
so that may be the reason but I have no experience in that area 
so can't really comment.


I am trying to put together a simple, expandable system that 
will folks to track and write reports for each turn of the game. 


Sounds like a good project, just take it step by step. 
A GUI is probably the last step! :-)


HTH,

--
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to Python

2009-10-21 Thread Wayne
On Tue, Oct 20, 2009 at 4:55 PM, lfsee...@comcast.net wrote:

 Hello all,
 Just started looking at Python, I have not programmed in a good 8-10 years
 now, and find myself woefully behind.


Luckily it shouldn't take you too much time with python - it's a lot easier
to learn/relearn than a lot of other languages!


 I was wondering if there was a Preset Menu and file system module for
 Python so I would not have to look at setting it all up?


The short answer: yes

But that leaves out a lot of details :)


 Trying to start again, Car wreck took me out for the last 10 years, and my
 memoery is lacking so I forget how things worked and now relearning things.


Well if you get stuck, we're glad to help around here :) Especially if you
follow the asking good questions guidelines you get in response to your
first email.


 Was never a true programmer mostly a trouble shooter for HW and SW
 development so I can scan and read code fair enough but was not the one
 writing code.


Honestly you probably got a decent amount of experience that way - I think
it may be more difficult reading someone else's code than reading your own!


 So basically (pardon the pun), is there a good reference online for using
 the libariers to give me a simple Interface with pull downs and such, file
 system and so?


There are *lots* of good online python references - including some written
by the folks around here.


 Last time I did any real coding had to write that myself, of course that
 was before many on the list was born I would guess.

 So I need a site that can handhold be a bit til whats left in the little
 gray cells can start working.

 The Issue that brings this up is I want to put together a program to help
 Miniature Wargame Players run mid to long campaign games, with all the
 wargames out there one would think there would be more than a few of these
 about, but there are very few and the better one still works like a DOS
 program.

 I am trying to put together a simple, expandable system that will folks to
 track and write reports for each turn of the game.


At first I was a little confused by what you wanted to do, but after reading
this it seems like you want a GUI? If so, Tkinter is probably the right
choice - I find it a lot simpler than most GUI libraries, but powerful
enough to handle what you need/want it to. Tkinter (indeed most python
scripts/GUIs) has the added benefit of being cross platform. If you write
something that works in windows, it probably works under another platform
(mac, *nix), as long as python is installed.


My personal recommendation would be to check out some of the regular
programming tutorials available - several written by some of the top
contributers here (in terms of activity, experience, and intelligence).
After you're refreshed as to some general programming concepts and syntax,
then it's a bit easier to pick up some of the GUIs. In reality, most people
have their favourite GUI, whether it be Tkinter, PyGTK+ (mine, but mainly
because I've found it has a bit more advanced drawing methods - I always
wanted to write up a sketchbook type program. Then I found mypaint, written
in PyGTK+ with a little bit of C that turns out to be perfect for my
desires), Qt, or any one of a number of others.

Most of those who are pretty familiar with their GUI of choice could
probably toss up a few features of the kind of thing you seem to be
describing (menus, forms) with very little trouble.

Python has lots of built-in file system operations/modules. You can easily
read/write a file from within python with no imports, although with what you
seem to want to do you might look at the pickle library (enables writing
then reading objects directly from a file, as opposed to just attributes),
configparser (which does pretty much what it sounds like - parses config
formatted files), or what might be the best option if you're planning to
support lots of campaign info - sqlite. Of course there are probably a few
people with other ideas and suggestions.

Anyway, HTH,
Wayne
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to python: some advises for image processing tool

2009-10-13 Thread Stefan Behnel
Nicola De Quattro wrote:
 while(var !=q0)
 print 
 Please select an action from the menu below:
 --
 o) Open an image
 +) Rotate the image of 1° clockwise
 -) Rotate the image of -1° clockwise
 r) Rotate the image of an input degree
 s) Show the image
 a) Save the image
 q) Quit Tipsy Imp
 --
 
 var = raw_input(Make a choice: );

var is a rather meaningless name for a variable. Something like choice
might be better here.

BTW, you might want to look into a GUI toolkit. There's tkinter that comes
with Python, and there are many others that aren't hard to use either.

http://wiki.python.org/moin/FrontPage?action=fullsearchcontext=180value=guititlesearch=Titel



 
 
 I've some questions:
 1) Is there a switch-case statement in Python? It seems to me not. How
 do you suggest to proceed in order to switch into var values?

Use a dict that maps characters to functions and then

lookup_dispatch_function = { 'o' : open_image, ... }.get

def error_fallback():
print(Invalid input, try again)

# ...

choice = raw_input(Make a choice: )
handle_input = lookup_dispatch_function(
choice.strip(), error_fallback)
handle_input()

Stefan

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to python: some advises for image processing tool

2009-10-13 Thread Eike Welk
On Monday 12 October 2009, Nicola De Quattro wrote:
 I've started to write something about input image loading and
 rotation. My goal is that, from graphical interface, the user will
 be able to rotate an image at steps (perhaps using two buttons) or
 by entering the amount of degree the image has to be rotated. I've
 writed the following main that will call some functions for
 rotating, saving, etc.

I think you shouldn't write text based menus either. You should just 
write a library of Python functions. To use your software you call 
these functions from the Python prompt. IPython, an extension for the 
standard Python interpreter, is good for it. You then work with 
Python similar to Matlab.
http://ipython.scipy.org/moin/

Only when the functions work, then you start to write more simple user 
interfaces. Your mail illustrates my point: You currently think about 
user interface stuff and not about the real problem, analyzing 
spectra of stars. 
 
A session with your software would then look like this:
~ ipython
In [1]: from analyze_spectra import *
In [2]: im1 = load_image(astro/spectra/13-10-2009/im1.fits)
In [3]: display_image(im1)
In [4]: im1rot = rotate_image(im1, 20, degrees=True)

And so on. 

This is much more flexible than Graphical or menu driven user 
interfaces, and it is much more comfortable for software development. 
You can write test scripts, instead of clicking around in your 
unfinished user interface. The added flexibility lets you do odd 
tasks, that a GUI can't do. And you get automation if you have many 
similar images for free.

If you have Windows users, they can install Python XY. This is a 
Package that contains a Python interpreter and many libraries for 
scientists. It contains the libraries that I have recommended, but 
unfortunately not Pyfits. It also contains Eclipse as a development 
environment. (I think it is even better than any repository for Suse 
Linux.) 
http://www.pythonxy.com/foreword.php


Kind regards,
Eike.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to python: some advises for image processing tool

2009-10-13 Thread Nicola De Quattro
 You currently think about
 user interface stuff and not about the real problem, analyzing
 spectra of stars.

Well, I think is exactly as you say. I've never developed entirely a
tool, so I started with the container rather then the content.
Thanks for the very useful (however simple) observation

 This is much more flexible than Graphical or menu driven user
 interfaces, and it is much more comfortable for software development.

It isn't completely clear to me the difference and advantages about
standard Python Interpreter (you can execute commands and test script
like Matlab, can't you?) but I think I try to install it and take a
look.

 If you have Windows users, they can install Python XY. This is a
 Package that contains a Python interpreter and many libraries for
 scientists. It contains the libraries that I have recommended, but
 unfortunately not Pyfits. It also contains Eclipse as a development
 environment. (I think it is even better than any repository for Suse
 Linux.)
 http://www.pythonxy.com/foreword.php

Very good, this seems good for my purposes, 'cause for now I don't use Pyfits.

Thank you very much for your help. I'll start to write and test single
modules as you advice.

-- 
Nicola De Quattro
Mobile: (+39)3292964937
Web: http://nikde4.altervista.org
Skype: lead_expression
MSNetwork: lead_express...@hotmail.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to python: some advises for image processing tool

2009-10-12 Thread Nicola De Quattro

Hi all
I'm starting with my project (rather slowly...) and I want to give you a 
little update (and do some trivial questions).


I've started to write something about input image loading and rotation. 
My goal is that, from graphical interface, the user will be able to 
rotate an image at steps (perhaps using two buttons) or by entering the 
amount of degree the image has to be rotated. I've writed the following 
main that will call some functions for rotating, saving, etc.




def tipsy_imp
Tests of Tipsy Imp input management

import Image, os, sys

print 
***
Tipsy Imp - Alpha version 0.0.1
by Nicola De Quattro
***


var = 0

while(var !=q0)
print 
Please select an action from the menu below:
--
o) Open an image
+) Rotate the image of 1° clockwise
-) Rotate the image of -1° clockwise
r) Rotate the image of an input degree
s) Show the image
a) Save the image
q) Quit Tipsy Imp
--

var = raw_input(Make a choice: );



I've some questions:
1) Is there a switch-case statement in Python? It seems to me not. How 
do you suggest to proceed in order to switch into var values?
2) If I want this script to automatically load a image that I give him 
as argument, I obtain filename by simply using the instruction:


import sys
input= sys.argv[1:]
image=Image.open(input)

So under Linux I type, from commandline

$ python main.py filename

It can be the same under Windows?

Thank you for your advices.

Nik


Nicola De Quattro ha scritto:

Hi,
I'm a 26 years old Italian engineer. Because to the fact that I'm an
astrophile and astronomical tool (expecially under Linux) are not so
common, I would like to develop some simple tool for some purposes.
Well, I'm not knew to software development but I've never used python.
So I want to list you my needed for the first tool, so you can tell me
if Python could be a good choice and how to begin the develop.
First of all, I need a software running both under Windows and Linux
at least (it would be better if running either under MacOS). This is a
first reason to choose Python.
Secondly, I want a OpenSource tool
The software shall be a tool for Star Analyzer (spectroscopic
analyzer) images. A similar software already exists, it can be seen at
this link (I'm sorry, it is in Italian, but you can understand from
the images what is the input and the output)

http://www.astropix.it/software/astrospectrum.html

So I've to open an image (various formats, first I could need only
.fits), to process the image in order to select the interesting strip
containing the star and the spectrum (first image of the link posted,
but I hope I can select the strip not only in the horizontal line but
I will rotate the image), to obtain a graph like the second and third
image (this may be simple, it plots the value of luminosity of each
point), calibrate the image using periodical table of elements as
shown in 6th image in order to color the graph.

Well, I know that many people doesn't understand the problem :) I hope
you can be able, with the elements reported above, how I have to
proceed, remembering that I've no problem programming in Matlab and C
but I've never worked with graphical interfaces and with image
processing (only under Matlab).

I've learned most of python commands. I think I've to start with some library?

Thank you very much and sorry for the poem (and for my english)!

PS: If the question is Why don't you use Astrospectrum? the answer
is: it is only for Linux and is not opensource :(



___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to python: some advises for image processing tool

2009-10-06 Thread Nicola De Quattro
Excuse me for the mistake, this list is a little different with respect 
to Yahoo Groups. Below my comments:



Now I think I could begin with some simple script to come into the
Python world, so I'll start building the easiest components of final
tool (perhaps opening the image and rotate it).


That one should be fairly simple - my guess is it should take  5 lines 
to do something like that with PIL or ImageMagick


I've read some documentation about this libraries, for now I think I'll 
use PIL(*), because it apparentely seems more similar to the approach I 
have just meet in the other programming language. On the other hand I 
think that starting with one or the other would be quitely unimportant 
for now.


My suggestion is this: Work with what you're comfortable with. If you 
want to use gedit and python interpreter, go ahead.


I'm agree, I'm starting with an automatic-parser editor with IDLE.

Thank you very much for your help, I shall return telling you my 
progression.


(*) PIL seems to support FITS file manipulation from release 1.1.5a1
http://effbot.org/zone/pil-changes-115.htm
It seems enough for my purposes.

Nik
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to python: some advises for image processing tool

2009-10-05 Thread Wayne
I think you forgot to hit Reply-all, so forwarding on to the list with my
response

On Mon, Oct 5, 2009 at 11:38 AM, Nicola De Quattro 
lead.express...@gmail.com wrote:

 Wayne ha scritto:

 The most difficult task would be analyzing the image and possibly some of
 the graph generation.



 Yes I has thought so. Probably it is the same for every language.

 Now I think I could begin with some simple script to come into the Python
 world, so I'll start building the easiest components of final tool (perhaps
 opening the image and rotate it).


That one should be fairly simple - my guess is it should take  5 lines to
do something like that with PIL or ImageMagick



 Another question I did'nt ask to the list is about the IDE. There's
 something like this in Python or not? I've used NetBeans for C. I'm not so
 expert with IDE but I think it might be useful something like this in order
 to share the same platform on both Linux and Windows (I think to develop on
 two different computers).


There are /many/ IDEs available, ranging from free (IDLE, included with
python) to over a hundred dollars (the super version of Wing IDE).


 If you suggest to use no IDE, the solution I've adopted since now is to use
 gedit and python bash program under Linux (it recognizes python sintax) and
 notepad++ with... what? under Windows (I think there's something like
 python package under Windows).


My suggestion is this: Work with what you're comfortable with. If you want
to use gedit and python interpreter, go ahead.

My personal preference (on any/all systems) is vi/vim in one terminal window
for the actual coding, and IPython in another window for testing snippets of
code. I have some fairly extensive python-centric modifications to my .vimrc
and other scripts and plugins.

I'm sure you'll find many different workflows that people use and several
folks will probably offer their setups for consideration.

I hope you find something comfortable for you, and feel free to ask any
questions if you get stuck.

HTH,
Wayne
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to python: some advises for image processing tool

2009-10-02 Thread Stefan Behnel
Nicola De Quattro wrote:
 So I've to open an image (various formats, first I could need only
 .fits), to process the image in order to select the interesting strip
 containing the star and the spectrum (first image of the link posted,
 but I hope I can select the strip not only in the horizontal line but
 I will rotate the image), to obtain a graph like the second and third
 image (this may be simple, it plots the value of luminosity of each
 point), calibrate the image using periodical table of elements as
 shown in 6th image in order to color the graph.

Without looking further into your problem, there are two (main) general
purpose image manipulation libraries for Python (that I know of) that you
may want to look at: PIL and ImageMagick. At least ImageMagick supports FITS.

Stefan

___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to python: some advises for image processing tool

2009-10-02 Thread Wayne
On Fri, Oct 2, 2009 at 8:44 AM, Stefan Behnel stefan...@behnel.de wrote:

 Nicola De Quattro wrote:
  So I've to open an image (various formats, first I could need only
  .fits), to process the image in order to select the interesting strip
  containing the star and the spectrum (first image of the link posted,
  but I hope I can select the strip not only in the horizontal line but
  I will rotate the image), to obtain a graph like the second and third
  image (this may be simple, it plots the value of luminosity of each
  point), calibrate the image using periodical table of elements as
  shown in 6th image in order to color the graph.

 Without looking further into your problem, there are two (main) general
 purpose image manipulation libraries for Python (that I know of) that you
 may want to look at: PIL and ImageMagick. At least ImageMagick supports
 FITS.


This is definitely a project you could do with python. It might take a fair
amount of programming, but it should certainly take less with python than
most other languages. Especially with the implementation of a GUI. I'd
suggest PyGTK+ simply because of the rather extensive documentation. I've
used both Tkinter and PyGTK and the latter is much easier to deal with when
using images, though YMMV.

The most difficult task would be analyzing the image and possibly some of
the graph generation.

HTH,
Wayne
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to python: some advises for image processing tool

2009-10-02 Thread Sander Sweers
2009/10/2 Stefan Behnel stefan...@behnel.de:
 Without looking further into your problem, there are two (main) general
 purpose image manipulation libraries for Python (that I know of) that you
 may want to look at: PIL and ImageMagick. At least ImageMagick supports FITS.

There is a python module for fits files. Never used it so the usual
caveats apply here ;-)
http://www.stsci.edu/resources/software_hardware/pyfits

Greets
Sander
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to python: some advises for image processing tool

2009-10-02 Thread Eike Welk
Hello Nicola!

For scientific computing there are the Numpy and Scipy libraries:
http://www.scipy.org/
For making graphs there is Matplotlib:
http://matplotlib.sourceforge.net/

You should join the mailing lists of these projects. 


For the GUI I would use QT4:
http://doc.trolltech.com/4.5/index.html
The Python bindings are called PyQt4:
http://www.riverbankcomputing.co.uk/news

You should also look at Enthought's Traits UI, which is specially 
dedicated to scientist, but I don't know if it can be installed on 
Linux. 
http://code.enthought.com/projects/traits/
Maybe Python's built in GUI might be good enough for you. 
http://wiki.python.org/moin/TkInter

However you should definitely write a command line program first, and 
start with the GUI when the program more or less works. GUI 
programming is a lot of work for a relatively small gain in 
usability. 


Good luck with your project,
Eike.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to python: some advises for image processing tool

2009-10-02 Thread Rüdiger Wolf
I remember reading some Python tutorials that where written specifically
for Astronomers.  Did a search on Google. This is not the tutorial I
originally read but maybe you will find it to be useful.

http://www.stsci.edu/hst/training/events/Python/readManDispImages_WU.pdf

Regards
Rudiger

On Fri, 02 Oct 2009 11:47 +0200, Nicola De Quattro
lead.express...@gmail.com wrote:
 Hi,
 I'm a 26 years old Italian engineer. Because to the fact that I'm an
 astrophile and astronomical tool (expecially under Linux) are not so
 common, I would like to develop some simple tool for some purposes.
 Well, I'm not knew to software development but I've never used python.
 So I want to list you my needed for the first tool, so you can tell me
 if Python could be a good choice and how to begin the develop.
 First of all, I need a software running both under Windows and Linux
 at least (it would be better if running either under MacOS). This is a
 first reason to choose Python.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to python(g)=python g=(embarrassing)

2008-07-07 Thread Jeremiah Stack
Hey

I want to thank you all for your patience, suggestions, constructive  
criticism, and idea  builders!
I now have good thoughts to start, i will now try some of the suggested 
tutorials and activities.
For me before the sugestions the turorials were like reading the sentence the 
tree is tall and black without knowing what tree, tall, and black are or why i 
needed to know that. 
Now i have a goal in mind something i think will be neat to work for. Hopefully 
now i will be able to pick up the concepts.

No programming background, working on my math along with my degree. imberising 

Thanks everyone

(i don't know if I'm supposed to say thank you as that might get redundant)



Date: Mon, 7 Jul 2008 17:33:37 +
From: [EMAIL PROTECTED]
To: tutor@python.org
Subject: Re: [Tutor] New to pythong

you can start with stuff you need like,  for example write a program that scans 
your hard disk  tells you the details about pdf, jpg, zip, avi files that you 
have, with creation date and sizes.
when you need help write us.




_
The i’m Talkaton. Can 30-days of conversation change the world?
http://www.imtalkathon.com/?source=EML_WLH_Talkathon_ChangeWorld___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] New to python(g)=python g=(embarrassing)

2008-07-07 Thread Marc Tompkins
I did wonder whether there was a joke there...  is the Pythong the hot new
trend in beachwear?

On a creepier note, if you make the mistake of going to python dot com
instead of dot org, a Pythong is the least of your worries...  eeewww.
-- 
www.fsrtechnologies.com
___
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor


  1   2   >