Re: [Tutor] Is there a package to "un-mangle" characters?

2013-11-21 Thread eryksun
On Thu, Nov 21, 2013 at 3:04 PM, Albert-Jan Roskam wrote: > > Today I had a csv file in utf-8 encoding, but part of the accented > characters were mangled. The data were scraped from a website and it > turned out that at least some of the data were mangled on the website > already. Bits of the tex

Re: [Tutor] Issue w/ while loops

2013-11-21 Thread Rafael Knuth
Hej there, @David @Peter @Amit: Thank you so much - you guys helped me understand my misconceptions and I learned a couple new things. On Thu, Nov 21, 2013 at 12:44 PM, Amit Saha wrote: > On Thu, Nov 21, 2013 at 9:00 PM, Rafael Knuth wrote: >> Hej there, >> >> I want to use a while loop in a pr

Re: [Tutor] Is there a package to "un-mangle" characters?

2013-11-21 Thread Mark Lawrence
On 21/11/2013 20:04, Albert-Jan Roskam wrote: Hi, Today I had a csv file in utf-8 encoding, but part of the accented characters were mangled. The data were scraped from a website and it turned out that at least some of the data were mangled on the website already. Bits of the text were actual

[Tutor] Is there a package to "un-mangle" characters?

2013-11-21 Thread Albert-Jan Roskam
Hi, Today I had a csv file in utf-8 encoding, but part of the accented characters were mangled. The data were scraped from a website and it turned out that at least some of the data were mangled on the website already. Bits of the text were actually cp1252 (or cp850), I think, even though the w

Re: [Tutor] Issue w/ while loops

2013-11-21 Thread Alan Gauld
On 21/11/13 13:17, Rafael Knuth wrote: I'm only stuck at one point: How do I loop back to the beginning in case the user input is invalid? Look at Peter's example. He set a variable to false when the input was wrong. You can check that value in your while loop. HTH -- Alan G Author of the L

Re: [Tutor] Issue w/ while loops

2013-11-21 Thread Amit Saha
On Thu, Nov 21, 2013 at 9:00 PM, Rafael Knuth wrote: > Hej there, > > I want to use a while loop in a program (version used: Python 3.3.0), > and I expect it to loop unless the user enters an integer or a > floating-point number instead of a string. > > print("TIME TRACKING") > hours_worked = inpu

Re: [Tutor] Issue w/ while loops

2013-11-21 Thread Dave Angel
On Thu, 21 Nov 2013 12:00:31 +0100, Rafael Knuth wrote: hours_worked = input("How many hours did you work today? ") while hours_worked != str() or int(): hours_worked = input("Can't understand you. Please enter a number! ") There are two problems with your conditional expression. First

Re: [Tutor] Issue w/ while loops

2013-11-21 Thread Peter Otten
Rafael Knuth wrote: > Hej there, > > I want to use a while loop in a program (version used: Python 3.3.0), > and I expect it to loop unless the user enters an integer or a > floating-point number instead of a string. > > print("TIME TRACKING") > hours_worked = input("How many hours did you work

[Tutor] Issue w/ while loops

2013-11-21 Thread Rafael Knuth
Hej there, I want to use a while loop in a program (version used: Python 3.3.0), and I expect it to loop unless the user enters an integer or a floating-point number instead of a string. print("TIME TRACKING") hours_worked = input("How many hours did you work today? ") while hours_worked != str()