On Thu, Aug 11, 2016 at 1:15 PM Pallab Amway wrote:
> expected an indented block
>
if-statements must have an indented block of code. For example:
```
if age < 12:
print('You are a child')
```
___
Tutor maillist - Tutor@python.org
To unsubscribe
On Tue, Aug 9, 2016 at 12:51 PM Cyrus Parvereshi wrote:
> Hi! I'm starting out with programming by self-studying python with a
> textbook used at my university. I came to a chapter that introduced object
> oriented programming with graphics tools like GraphWin and Point. However,
> even though I
On Fri, Jul 29, 2016, 2:11 AM Darah via Tutor wrote:
> "IDLE's subprocess didn't make connection. Either IDLE can't start a
> subprocess or personal firewall software is blocking the connection.”
>
In the last few days, have you installed any other software? Perhaps
something has changed your f
On Fri, Jul 8, 2016 at 10:15 AM Bruce Dykes wrote:
> I'm compiling application logs from a bunch of servers, reading the log
> entries, parsing each log entry into a dictionary, and compiling all the
> log entries into a single list of dictionaries.
>
Seems reasonable. Perhaps instead of having
On Wed, Jul 6, 2016 at 10:59 AM wrote:
> why do I have to create a variable txt_again to assign it to the open
> function and them print the file?
> why is it that I can't only write something like open(file_again).read()?
>
Good insight. In fact you don't need to create the variable. The code `
On Tue, Jul 5, 2016 at 5:36 PM Michael Selik
wrote:
> On Sat, Jul 2, 2016 at 8:29 AM Alan Gauld via Tutor
> wrote:
>
>> There are arguably easier ways of doing this
>>
>
> I think you'll find that for-loops are preferable to while-loops. Here's
>
On Tue, Jul 5, 2016 at 8:24 PM wrote:
> I'm having trouble with most of the lines here.
>
It looks like you tried to attach a file. This mailing list does not allow
attachments. Instead, could you paste the code into your email?
> things that I don't understand:
> 1. the need to put script int
On Sat, Jul 2, 2016 at 8:29 AM Alan Gauld via Tutor
wrote:
> There are arguably easier ways of doing this
>
I think you'll find that for-loops are preferable to while-loops. Here's an
alternative implementation.
https://gist.github.com/selik/d8e0a7622ceff0fe8984a7d19d44bfca
import random
On Fri, Jun 24, 2016 at 11:58 AM Alex Hall wrote:
> I know loops, comprehensions, ifs, and the like,
> but I never knew for-else was available. Are there other constructs that I
> may have missed?
>
Are you familiar with context managers?
https://www.python.org/dev/peps/pep-0343/
___
On Fri, Jun 17, 2016, 6:12 PM Lulu J wrote:
> Hi there,
>
> My apologies if this is a trivial question but I am sort of new to python.
> Here is my problem:
> I have a list of dictionaries. Each dictionary has a word and its position
> in the text the positions are in the form of a tuple.
> Here
On Fri, Jun 17, 2016 at 12:46 PM boB Stepp wrote:
> ftp = FTP('ip_address', 'username', 'password')
>
> Or
>
> ftp = FTP('ip_address')
> ftp.login('username', 'password')
>
> Most of the examples I am seeing online use the second approach. Is
> there some reason why this is to be preferred?
No
On Fri, Jun 17, 2016 at 11:42 AM boB Stepp wrote:
> On Thu, Jun 16, 2016 at 11:40 AM, Alan Gauld via Tutor
> wrote:
> > On 16/06/16 16:38, boB Stepp wrote:
> >
> >> class FTPFiles(FTP, object):
> >> """FTP files to Windows server location(s)."""
>
> I was struggling to come up with a good na
On Mon, Jun 13, 2016 at 6:28 PM Alan Gauld via Tutor
wrote:
> On 13/06/16 08:46, Ek Esawi wrote:
> > Here is a beginner code that might work for you. Best of luck. EK
> >
> > b=[12, 20, 35]
> >
> > for i in range(len(b)):
> > if i==0:
> > c=0
> > else:
> > c=b[i-1]
On Mon, Jun 13, 2016 at 1:33 PM Ek Esawi wrote:
> Here is a beginner code that might work for you. Best of luck. EK
>
> b=[12, 20, 35]
>
> for i in range(len(b)):
> if i==0:
> c=0
> else:
> c=b[i-1]
> for j in range(c, b[i]):
> print(i+1,j+1)
>
If
On Wed, Jun 8, 2016 at 12:53 PM Alex Hall wrote:
> All,
> I'm working on a project that writes CSV files, and I have to get it done
> very soon. I've done this before, but I'm suddenly hitting a problem with
> unicode conversions. I'm trying to write data, but getting the standard
> cannot encode
ue, May 31, 2016 at 8:03 PM, Michael Selik
> wrote:
>
>> On Tue, May 31, 2016 at 5:45 PM Vadim Katsemba
>> wrote:
>>
>>> I typed in lm = smf.ols(formula='LATITUDE~DIAMETER',data=dataf).fit(),
>>> and I ended up getting this error: ValueError: For n
On Tue, May 31, 2016 at 5:45 PM Vadim Katsemba wrote:
> I typed in lm = smf.ols(formula='LATITUDE~DIAMETER',data=dataf).fit(), and
> I ended up getting this error: ValueError: For numerical factors,
> num_columns must be an int.
>
You may be using an old version of Patsy, the module that allows
On Fri, May 20, 2016 at 7:16 AM jarod_v6--- via Tutor
wrote:
> Thanks s much for the help. I want to obtain table like this:
>
>
> >csv.writer(sys.stdout, delimiter="\t").writerows(table)
> >A100D33 D34 D35 D36 D37 D38 D39
> >A 5 0 ...
> >B
On Fri, May 20, 2016 at 8:42 AM Peter Otten <__pete...@web.de> wrote:
> jarod_v6--- via Tutor wrote:
> > I have tried the pandas way but unfortunately there is many duplicates .
>
> Please show your code in a small self-contained example,
> the output it produces, and what exact output you want in
On Sun, May 8, 2016, 12:34 PM Hunter Jozwiak wrote:
> Hello,
>
>
>
> I am intending to start work on a Python program that will allow me to
> better manage my Digital Ocean droplets, due to the fact that the website
> can be at times a bit overkill for some of the basic tasks I want to do. I
> ha
On Mon, May 2, 2016 at 5:28 PM Jason N. via Tutor wrote:
> Hello,
> Wanted to ask if its possible to have a dictionary that can be looked up
> by either values?
> For example,
> mydic = {"A: "Apple", "B": "Banana"}When user inputs "A" I want "Apple" to
> come. But if the user enter "Apple" I want
On Mon, May 2, 2016 at 8:58 PM Jason N. via Tutor wrote:
> What is the best way to make dictionary requests case in-sensitive? For
> example, "Apple and "apple" should bring back the same dictionary
> response. Thank you.
>
Take a look at how the requests library solves the problem with a
"CaseI
> On Apr 29, 2016, at 1:15 PM, Colin Ross wrote:
>
> Hello,
>
> I have an array that takes on the following form:
>
> x = [1000,1001,1011,]
>
> The array elements are meant to be binary representation of integers.
>
> Goal: Access array elements and extract the first two bits.
>
> e.g.
What's the problem you're trying to solve? Did you get an error?
Here's a quick revision. There's probably a more elegant way, but this
seems to work.
#/usr/bin/env python
from __future__ import print_function
import random
try:
input = raw_input
except NameError:
On Fri, Apr 22, 2016 at 1:57 PM Rene.Castillo wrote:
> expected output-
> reverse_words("This is an example!") # returns "sihT si na !elpmaxe"
>
> def reverse_words(strng):
> strng = strng[::-1].split(' ')
> strng.reverse()
> return ' '.join(strng)
>
Let's walk through each step that you
25 matches
Mail list logo