Re: [Tutor] Splitting email headers when using imaplib

2014-02-04 Thread spir
On 02/04/2014 06:38 PM, Some Developer wrote: I'm currently trying to download emails from an IMAP server using Python. I can download the emails just fine but I'm having an issue when it comes to splitting the relevant headers. Basically I'm using the following to fetch the headers of an email m

Re: [Tutor] I am teaching my students Python the second semester using www.LearnStreet.com ( http://www.learnstreet.com/ ). I am in need of some help. I am having a problem with the Lists-Set 1 exerci

2014-02-04 Thread Danny Yoo
On Tue, Feb 4, 2014 at 11:31 AM, Thomas Maher wrote: > Thank you for helping me. I used a similar code, but with an if statement. > if list1 in list2: > return len(list2[-1]) > > This is the code they sent me this morning. > > def len_of_innerlist(list2): > for ele in list2: > if isinstance(e

Re: [Tutor] I am teaching my students Python the second semester using www.LearnStreet.com ( http://www.learnstreet.com/ ). I am in need of some help. I am having a problem with the Lists-Set 1 exerci

2014-02-04 Thread Danny Yoo
The question as stated is fairly artificial and a bit nonsensical. Let me explain that statement, because it's a strong one. If we know the exact shape for list1 and list2 are, we can answer this question directly, without loops. len(list1[-1]) "Take the last element of the list1, and grab i

[Tutor] Splitting email headers when using imaplib

2014-02-04 Thread Some Developer
I'm currently trying to download emails from an IMAP server using Python. I can download the emails just fine but I'm having an issue when it comes to splitting the relevant headers. Basically I'm using the following to fetch the headers of an email message: typ, msg_header_content = self.m.fe

Re: [Tutor] unsigned int or char equivalent in Python?

2014-02-04 Thread Alan Gauld
On 04/02/14 15:01, Peter Otten wrote: Alan Gauld wrote: This led me to wonder if there is a way to get unsigned type behaviour in Python? I think you have to apply a mask: -2 & 0xff 254 Ah! obvious when you see it! :-) And I'm applying masks all over the place but didn't think of using

Re: [Tutor] unsigned int or char equivalent in Python?

2014-02-04 Thread Peter Otten
Alan Gauld wrote: > I'm playing with some bit twiddling code at present and started > to get some unexpected results which i eventually realized > were down to Python ints acting like signed ints in C (but > with a 'flexible' sign bit!) > > This led me to wonder if there is a way to get unsigned

[Tutor] unsigned int or char equivalent in Python?

2014-02-04 Thread Alan Gauld
I'm playing with some bit twiddling code at present and started to get some unexpected results which i eventually realized were down to Python ints acting like signed ints in C (but with a 'flexible' sign bit!) This led me to wonder if there is a way to get unsigned type behaviour in Python? Thi

Re: [Tutor] strange errors

2014-02-04 Thread Peter Otten
Gabriele Brambilla wrote: > ok. > the problem is that my "errors" are not always the same and sometimes they > are only differences in the results displayed (with the same starting data > and no random variables used between). Sometimes randomness lurks where you don't expect it. Are there any di

Re: [Tutor] strange errors

2014-02-04 Thread Gabriele Brambilla
ok. the problem is that my "errors" are not always the same and sometimes they are only differences in the results displayed (with the same starting data and no random variables used between). so it's difficult for me to understand where the error is (and to give you a piece of code that can run).

Re: [Tutor] My First Post

2014-02-04 Thread Dave Angel
Danny Yoo Wrote in message: > (Sorry if you get this message twice: I think I accidently mis-sent > the message to the wrong address, so to make sure, I'm sending to what > I think is the right address this time.) > > --- > > Hi Premanshu, [deleting useful advice] Welcome to the list. When

Re: [Tutor] input python 3.3

2014-02-04 Thread Dave Angel
Ian D Wrote in message: > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > When making an amendment to a post, please reply to that post; don't start a new

Re: [Tutor] conditionals or comparison or expressions terminology

2014-02-04 Thread Peter Otten
Ian D wrote: > Are: > > <= > == > != > > simple conditionals statements, conditionals, comparison operators, > conditional expressions or what? [comparison] operators: http://docs.python.org/3.3/reference/lexical_analysis.html#operators a <= b # expression (something is evaluated; ideally t

Re: [Tutor] Any ideas

2014-02-04 Thread Dave Angel
josh Malone Wrote in message: > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: > https://mail.python.org/mailman/listinfo/tutor > First thing is to figure your goal. "Model" might mean anything from "figur

[Tutor] conditionals or comparison or expressions terminology

2014-02-04 Thread Ian D
Hi Are: <= == != simple conditionals statements, conditionals, comparison operators, conditional expressions or what? I am looking at a few different pages and am unsure what I should be calling these expressions. http://anh.cs.luc.edu/python/hands-on/3.1/handsonHtml/ifstatements.html#s

Re: [Tutor] I am teaching my students Python the second semester using www.LearnStreet.com ( http://www.learnstreet.com/ ). I am in need of some help. I am having a problem with the Lists-Set 1 exerci

2014-02-04 Thread Peter Otten
Thomas Maher wrote: > I am teaching my students Python the second semester using > www.LearnStreet.com ( http://www.learnstreet.com/ ). I am in need of some > help. I am having a problem with the Lists-Set 1 exercise 18. The > problem is below. I have put in several codes and the output is 5,

Re: [Tutor] Rsync script hangs after a while

2014-02-04 Thread Peter Otten
Dayo wrote: > I wrote this script (http://bpaste.net/show/175284/) to help me > automate some rsync backups, and whenever I run the script for large > syncs, it just freezes after a while, and then I have to Ctrl+C it. I Maybe you are just lacking patience ;) > can find any clues in both source

Re: [Tutor] Rsync script hangs after a while

2014-02-04 Thread Alan Gauld
On 04/02/14 09:10, Dayo wrote: I wrote this script (http://bpaste.net/show/175284/) to help me automate some rsync backups, and whenever I run the script for large syncs, it just freezes after a while, and then I have to Ctrl+C it. You have quite a few prints in there so you should have some

Re: [Tutor] input python 3.3

2014-02-04 Thread Alan Gauld
On 04/02/14 09:01, Ian D wrote: I used to use 2.7 and the input was pretty when inputting a numeric value, it would just get cast to an int. Just to be picky it would get converted to an int not cast as an int. casting and converting are two very different things. casting means treat a bit pa

Re: [Tutor] JES question concerning syntax

2014-02-04 Thread Peter Otten
Siobhan Wojcik wrote: > Hello, > > I've been having an issue with a program that I'm writing. The program > works until it has to compute something: > > def carPmt(): > cost = requestInteger("How much does the car cost?") > downPmt = requestInteger("If there is a down payment, how much?") >

[Tutor] I am teaching my students Python the second semester using www.LearnStreet.com ( http://www.learnstreet.com/ ). I am in need of some help. I am having a problem with the Lists-Set 1 exercise 1

2014-02-04 Thread Thomas Maher
I am teaching my students Python the second semester using www.LearnStreet.com ( http://www.learnstreet.com/ ). I am in need of some help. I am having a problem with the Lists-Set 1 exercise 18. The problem is below. I have put in several codes and the output is 5, which is the right answer.

[Tutor] JES question concerning syntax

2014-02-04 Thread Siobhan Wojcik
Hello, I've been having an issue with a program that I'm writing. The program works until it has to compute something: def carPmt(): cost = requestInteger("How much does the car cost?") downPmt = requestInteger("If there is a down payment, how much?") tradeIn = requestInteger("If there is a

[Tutor] Any ideas

2014-02-04 Thread josh Malone
Hi, I'm very new to programming and python is my first language. I'm currently enrolled in a class at Oregon State University where we are taught to program in python. I'm stuck on one problem and i know what i want to do... i just have no idea how to write the program. The question is as follows

Re: [Tutor] input python 3.3

2014-02-04 Thread Peter Otten
Ian D wrote: > Hello > > I used to use 2.7 and the input was pretty when inputting a numeric value, > it would just get cast to an int. > > Seems that 3.3 I have to cast each input so : > float(num1 = input("Enter a number") You mean num1 = float(input("Enter a number")) > Is this just t

[Tutor] Rsync script hangs after a while

2014-02-04 Thread Dayo
Hi I wrote this script (http://bpaste.net/show/175284/) to help me automate some rsync backups, and whenever I run the script for large syncs, it just freezes after a while, and then I have to Ctrl+C it. I can find any clues in both source and target /var/log/* files. Any idea how I can find out

[Tutor] input syntax I just posted totally wrong

2014-02-04 Thread Ian D
num1 = float(input("enter a number ")) I meant not float(num1 = input("Enter a number")) ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org

[Tutor] input python 3.3

2014-02-04 Thread Ian D
Hello I used to use 2.7 and the input was pretty when inputting a numeric value, it would just get cast to an int. Seems that 3.3 I have to cast each input so : float(num1 = input("Enter a number") Is this just they way it is now? Is there a way to get back to just typing: num1 = input("Ent