Re: [Tutor] What are your favourite unofficial resources

2014-07-07 Thread Albert-Jan Roskam
>> On 30 June 2014 04:11, Alan Gauld  wrote:

>>>  I'm looking for tips for an appendix to a book that
>>>  I'm working on.
>>> 
>>>  What are the best unofficial (ie not python.org)
>>>  resources for people who have learned the basics
>>>  but are not experts yet? ie Typical tutor list
>>>  "graduates"...
>>> 
>>>  I'm thinking about web sites, blogs, books, videos etc.
>>>  Anything that might be worth knowing about.
>>> 
>>>  I've got a few of my own - Activestate, O'Reilly,
>>>  ByteOfPython, PythonChallenge, ShowMeDo etc.
>>> 
>>>  But I thought the tutor list readers might be an
>>>  interesting source of alternatives that I hadn't
>>>  thought of, or even heard of.
>>> 
>>>  All contributions considered :-)

Not sure if this one has been mentioned already: effbot.org. An absolute must!
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python Socket Error: Connection refused

2014-07-07 Thread Dave Angel
Pamela Wightley  Wrote in message:
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
> 

You apparently are running Windows, and in a corporate
 environment. You don't tell us your Python version,  but in this
 case my advice doesn’t care.

IDLE works by creating two processes,  IDLE itself and your Python
 code. Those processes then have to talk to each other, 
 presumably by using network sockets. 

Any computer with network access should protect itself from
 hackers and network intrusions, and first line of defense is
 usually a firewall. If you're in a corporate environment,  the IT
 department has probably got that tightly controlled. So the next
 step would presumably be getting them to open a cat door for you.
 They'll have to know IDLE enough to figure out what port to use, 
 or to configure IDLE to use one they already have open. I haven't
 done anything important in Windows for years so I can't be more
 specific than that. 

A better answer is probably to skip IDLE.  I've never used it, nor
 missed it. You can do most anything you want from a cmd prompt
 (DOS box). Start python from there, and play to learn from there.
 You'll also need a good programming editor (not Notepad), but
 there are many free choices.  One is Komodo Editor, but I only
 mention that because it's a subset of the not-free Komodo IDE
 that I use sometimes.  Mostly I use emacs.

You will want to configure your DOS Box to make it easier to cut
 and paste. That way you can copy back and forth between there and
 the editor or a browser window or an email program.
 

-- 
DaveA

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


Re: [Tutor] Python Socket Error: Connection refused

2014-07-07 Thread Matthew Ngaha
On Mon, Jul 7, 2014 at 12:55 PM, Dave Angel  wrote:

> You will want to configure your DOS Box to make it easier to cut
>  and paste.

How is this done? I'm not on windows atm to test it.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python Socket Error: Connection refused

2014-07-07 Thread Emile van Sebille

On 7/7/2014 10:16 AM, Matthew Ngaha wrote:

On Mon, Jul 7, 2014 at 12:55 PM, Dave Angel  wrote:


You will want to configure your DOS Box to make it easier to cut
  and paste.


How is this done? I'm not on windows atm to test it.


I think it's referring to the two edit options on the options tab of the 
cmd.exe properties.


Emile


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


Re: [Tutor] Python Socket Error: Connection refused

2014-07-07 Thread Pamela Wightley
Thank you for your response. I installed python last week and it has been 
working fine until this afternoon. I will investigate the firewall prohibitions.

Pamela Wightley
MARQ Services
Tel: 040 089 2714

On 7 Jul 2014, at 4:49 pm, "Danny Yoo"  wrote:

>> I need some help, I  have no programming skills and am trying to teach 
>> myself python. I keep on getting an error message as follows:
> 
> [content cut]
> 
> It appears from the screenshot that you are running some version of
> Windows that has software that's interfering with IDLE.  As the error
> message says,
> 
> "IDLE's subprocess didn't make connection.  Either IDLE can't start a
> subprocess or personal firewall software is blocking the connection."
> 
> I would believe the error message.  The IDLE program is trying to
> create a network connection, but fails to do so.
> 
> Windows machines typically have a restrictive firewall that limit
> certain operations.  Do you know if you have a firewall running on
> your computer?  Note that there are other kinds of software that will
> interfere, such as proxy network software.  See:
> http://bugs.python.org/issue14576 for an example of such interference
> by an external piece of software.
> 
> 
> Software installation is stupid-hard.  If you are just starting off,
> you might be able to use one of the "online" Python-based
> environments, at least as a temporary workaround until you can resolve
> your installation issue.  See:
> 
>http://repl.it/languages/Python
> 
> It's not a perfect solution, but at least you may be able to start
> doing simple experiments with Python without having to fight with
> installation.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] Python Socket Error: Connection refused

2014-07-07 Thread Alan Gauld

On 07/07/14 06:10, Pamela Wightley wrote:

Hi,

I need some help, I  have no programming skills and am trying to teach
myself python. I keep on getting an error message as follows:

Socket Error: Connection refused,



This is a common problem with IDLE in some environments.
There is a workaround by providing a command line switch to IDLE that 
prevents it using sockets.


You probably need to edit your Windows shortcut to say something
like:

idle -n

Alternatively if you are on Windows use the ActiveState download of 
Python instead since it is much better at setting paths etc and includes 
Pythonwin which is much better than IDLE. Make sure you

get the free (Community?) edition.

--
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


[Tutor] need help reading the code

2014-07-07 Thread keith papa
  # Hi am leaning python with A Byte of Python - Swaroop CH and am a little confused with The format method. So I leaned that printing the code:


>>>age = 20

>>>name = 'Swaroop'


>>>print '{0} was {1} years old when he wrote this book'.format(name, age)

>>>print 'Why is {0} playing with that python?'.format(name)

# I no that the code will give you the same output even without numbers:

Swaroop was 20 years old when he wrote this book

Why is Swaroop playing with that python?





#Am having little trouble trying to understand this part of the code:

# decimal (.) precision of 3 for float '0.333'

>>>print '{0:.3f}'.format(1.0/3)
# fill with underscores (_) with the text centered
# (^) to 11 width '___hello___'


>>>print '{0:_^11}'.format('hello')
# keyword-based 'Swaroop wrote A Byte of Python'


>>>print '{name} wrote {book}'.format(name='Swaroop',
 book='A Byte of Python')

# Line 1: I know the first line has the out put of 0.333 because 1.0 is divided by 3.

# Line 2: why is the output:  ___hello___ and not just hello?
#what does {0:_^11} mean?





#any other information you may have, please share with me.___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] need help reading the code

2014-07-07 Thread Alan Gauld

On 07/07/14 19:29, keith papa wrote:

Please post in plain text and avoid attachments if possible.
Just paste code directly into the email.

I've had to cut n paste everything to write this which is a pain...

>>> print '{0} was {1} years old when he wrote this book'.format(name, age)

>>> print 'Why is {0} playing with that python?'.format(name)

# I no that the code will give you the same output even without numbers:

Yes the numbers are not needed here but consider this example:

>>> print "{0} loves {1} but {2} hates {0}!".format('Joe', 'food', 'Anne')

Now you need the numbers because you are using the same value (0)twice.

I'll look at the other issues in separate mails.

--
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] need help reading the code

2014-07-07 Thread Alan Gauld

On 07/07/14 19:29, keith papa wrote:
# decimal (.) precision of 3 for float '0.333'

>>> print '{0:.3f}'.format(1.0/3)

The best way to see how this works is to try it
with different values:

>>> print('{0:.3f}'.format(1.0/3))
0.333
>>> print('{0:.5f}'.format(1.0/3))
0.3
>>> print('{0:.1f}'.format(1.0/3))
0.3
>>> print('{0:.5f}'.format(1.0/2))
0.5
>>>

Look at how many digits appear after the decimal
point in each case.


# fill with underscores (_) with the text centered
# (^) to 11 width '___hello___'

>>> print '{0:_^11}'.format('hello')

Again, try it out with different values.
The tricky thing here is that he is showing 3 different features in one 
example.

Try breaking them down into 3 different sets then
building them back up:

set width of field:

>>> print('{:11}'.format('hello'))
hello
>>> print('{:3}'.format('hello'))
hello
>>>

Hmmm, Doesn't seem to do anything...Lets add some justification

>>> print('{:<11}'.format('hello'))
hello
>>> print('{:>11}'.format('hello'))
  hello
>>> print('{:^11}'.format('hello'))
   hello

Somethings happening, but to really see what it is...

add a padding character so you see the 'spaces;:

>>> print('{:_>11}'.format('hello'))
__hello
>>> print('{:_<11}'.format('hello'))
hello__
>>> print('{:_^11}'.format('hello'))
___hello___

Which is where we came in...

Try different padding characters and change the width values.

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


[Tutor] Next steps...

2014-07-07 Thread Ni Hung
ok, I am now able to write scripts in python. I can read/modify scripts
written by others (true to some level).  I understand the basics of
libraries (how are they different from modules or are the same thing with
two names?)  like urllib2, json, sys, os etc. and have used them in some
scripts.

What should I do next to advance my knowledge of python? Should I study/use
libraries/modules?  Which ones?  Any other suggestions?

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