Re: [Tutor] difference between expressions and statements

2014-04-10 Thread Jared Nielsen
Thanks for the thorough answer, Bob. I now understand the difference. On Apr 10, 2014 2:11 PM, bob gailer bgai...@gmail.com wrote: Caveat: I began this before there were any other responses. So this may be overkill - but I ike to be thorough. On 4/9/2014 12:49 PM, Jared Nielsen wrote: Hi

Re: [Tutor] question about strip() and list comprehension

2014-04-09 Thread Jared Nielsen
Thank Danny, That's much more clear. But I still don't understand what's happening with: if line.strip() Is that stripping the line of white space at the same time that it is testing it? On Tue, Apr 8, 2014 at 3:44 PM, Danny Yoo d...@hashcollision.org wrote: Could someone explain why and

Re: [Tutor] question about strip() and list comprehension

2014-04-09 Thread Jared Nielsen
Thanks Danny! That was an awesome explanation. On Tue, Apr 8, 2014 at 7:05 PM, Danny Yoo d...@hashcollision.org wrote: if line.strip() Is that stripping the line of white space at the same time that it is testing it? Two features about Python: 1. Strings are immutable, so the above

[Tutor] difference between expressions and statements

2014-04-09 Thread Jared Nielsen
Hi Pythons, Could someone explain the difference between expressions and statements? I know that expressions are statements that produce a value. I'm unclear on functions and especially strings. Are any of the following expressions? print(42) print(spam) spam = 42 print(spam) Is the first

[Tutor] question about strip() and list comprehension

2014-04-08 Thread Jared Nielsen
Hello, Could someone explain why and how this list comprehension with strip() works? f = open('file.txt') t = [t for t in f.readlines() if t.strip()] f.close() print .join(t) I had a very long file of strings filled with blank lines I wanted to remove. I did some Googling and found the above

[Tutor] how to iterate through a dictionary and assign list values?

2013-12-04 Thread Jared Nielsen
I want to create a dictionary, assign it keys, then iterate through a for loop and assign the dictionary values from a list. I'm trying this, but it's not working: dictionary = {one, two, three} list = [1,2,3] for key in dictionary: for value in list: dictionary[key] = value I get

[Tutor] how to only loop over first 'x' items of a list; writing a Twitter bot with tweepy

2013-11-25 Thread Jared Nielsen
Hi all, Noob. For a beginner project I'm hacking together a Twitter bot with tweepy. I've got one more or less functional, but I'm running into a problem when making a list of followers by calling the Twitter api. I'm getting a 'Rate limit exceeded' error, which, evidently is due to changes in

Re: [Tutor] I need a good resource for python Django

2013-08-20 Thread Jared Nielsen
Hi, Can anyone suggest me a good resource for python Django. I've gone through the official website of Django but it is of limited use to me. Any help on this would be highly appreciated. I recommend Mike Hibbert's YouTube series on Django.

[Tutor] python as poetry

2013-01-03 Thread Jared Nielsen
I don't know if it's appropriate to post things like this on the list, but I've learned a lot from this group and thought I'd share something I think you all will enjoy: http://www.thehelloworldprogram.com/videos/poetry-corner-red-wheelbarrow/ ___ Tutor

Re: [Tutor] how to split/partition a string on keywords?

2012-08-24 Thread Jared Nielsen
Thanks everyone. As I'm learning programming what I find most interesting is that there's always more than one way to solve a problem. I implemented eryksun's suggestion and used the replace() method. But, playing around with it, what I discovered is that it won't store the change. For example,