[Tutor] Python Projects

2014-12-07 Thread Bo Morris
The book arrived this morning. Thanks Alan! Bo ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Help understanding classes

2014-11-15 Thread Bo Morris
Thank you Alan and Danny. It amazes me at the lengths you guys, as well as everyone else who contributes, will go to to help explain things to us; it is greatly appreciated! Alan, I decided to dumb down the learning classes just a little. By this I mean, I am not using Tkinter to learn classes

Re: [Tutor] Practicing with sockets

2014-10-31 Thread Bo Morris
hile True: data = client_socket.recv(4029) f.write(data) if not data: break #f.flush() f.close() client_socket.close() On Fri, Oct 31, 2014 at 3:42 PM, Bo Morris wrote: > Hey Danny, yes I have been having quite a bit of fun learning to work with > sockets. Thank you for you

Re: [Tutor] Practicing with sockets

2014-10-31 Thread Bo Morris
Hey Danny, yes I have been having quite a bit of fun learning to work with sockets. Thank you for your response. I have applied what you suggested with the exception of the "logging." I read through the logging docs and figured logging would be learning for another day. I have a hard time enough st

[Tutor] Practicing with sockets

2014-10-31 Thread Bo Morris
Hello all, hope everyone is doing well. I have been practicing with sockets and I am trying to send a small png from the client to the server. the client code is... import socket f = open('/Users/Bo/Desktop/logo_ONEConnxt.png', 'rb') strf = f.read() client_socket = socket.socket(socket.AF_INET,

Re: [Tutor] Code critique

2014-10-24 Thread Bo Morris
Thank you all for the helpful criticism. I wish I was able to catch on to what you are suggesting more quickly. Based on your recommendations, I have come up with the following so far, however I just dont see it as easily as I did while using the if/elif statements. This is what I have so far. I

Re: [Tutor] Code critique

2014-10-24 Thread Bo Morris
"...Regarding your program, instead of writing long sequences of repetitive if conditions, I would write one function for each of the different operations and store them in a dict, mapping each host name to a function (and multiple host names may map to the same function). Then, look up the host na

[Tutor] Code critique

2014-10-24 Thread Bo Morris
Hello all, May I please get a little instructional criticism. The code below works. It logs into 9 different Linux computers, runs a couple commands, and then transfers a file back to the server. I want to become a better Python coder; therefore, I was hoping for some ways to make the below code b

[Tutor] Insert time into email...final code

2014-10-22 Thread Bo Morris
Just in case anyone else can benefit from this, here is my working code up to this point #!/usr/bin/python import smtplib from email.MIMEMultipart import MIMEMultipart from email.MIMEText import MIMEText from email.MIMEImage import MIMEImage import time strFrom = "HourlyReport.com" strTo = "mye

[Tutor] Insert time into email

2014-10-20 Thread Bo Morris
hello all, hope everyone is doing well. The below code works, however I am going back and trying to enter the time and date and I cant quite figure out how to do this without breaking the code. #!/usr/bin/python import smtplib from email.MIMEMultipart import MIMEMultipart from email.MIMEText imp

[Tutor] printing all text that begins with "25"

2014-10-02 Thread Bo Morris
Hello all, hope everyone is doing well. When I run the linux command "hamachi list" i get something along the lines of the following output 087-888-279 Pandora25.x.x.xxx alias: not set 096-779-867 AM1LaptopBD-PC25.x.x.xxx alias: not set

[Tutor] command counter

2014-09-05 Thread Bo Morris
Here is the shell script I am trying to recreate in python. Sorry for not posting this with my other emails...I am a bit off today. restart_count=10 count=10 restart=5 while ((count--)); do avconv -v verbose -re -analyzeduration 0 | ./bmdplay -m 2 -f pipe:0 echo "Retry" if [[ $count = 1

[Tutor] command counter

2014-09-05 Thread Bo Morris
I think I figured it out... each time I run subprocess.Popen("command"), I also have to count += 1, which adds 1 to count each time the command is run. Is this correct, or is there a better way? Thanks ___ Tutor maillist - Tutor@python.org To unsubscr

[Tutor] command counter

2014-09-05 Thread Bo Morris
how would I keep track of count for each time a command exectuted? for example... subprocess.Popen("command") && add 1 to count. If count equals n number, do something. I have tried count = 0 count += 1, but count does not seem to be incrementing. Thanks

[Tutor] interacting with stderr

2014-08-30 Thread Bo Morris
Here is my working code. It works great in the lab, but I still need to test it on a live system. I also need to add the email notifications to it, but I purposely left them out for now; I will also adjust the sleep time to a more appropriate amount. Anyone see any issues with it or ways to make it

Re: [Tutor] Quantum computing (Alan Gauld)

2013-12-14 Thread Bo Morris
tor Digest, Vol 118, Issue 62 (Keith Winston) >4. Re: list comprehension equivalent to map(function,list item) > (Bo Morris) >5. Re: weird lambda expression -- can someone help me understand > how this works (Alan Gauld) >6. Re: Quantum computing (Alan Gauld) &

Re: [Tutor] list comprehension equivalent to map(function, list item)

2013-12-14 Thread Bo Morris
reference? Again, thank you. AngryNinja On Fri, Dec 13, 2013 at 9:24 PM, Amit Saha wrote: > On Sat, Dec 14, 2013 at 11:03 AM, Bo Morris wrote: > > i have the following simple function that iterates over the list. It > passes > > the list item into the function and adds the nu

[Tutor] list comprehension equivalent to map(function, list item)

2013-12-13 Thread Bo Morris
i have the following simple function that iterates over the list. It passes the list item into the function and adds the numbers. What would be the equivalent way of writing the "map" portion with list comprehension? My code is as follows: def add(number): print 1 + int(number) x = ['2', '4