[Tutor] adding users to tweets on a list
Saad Javed
sbjaved at gmail.com
Tue Aug 6 19:49:19 CEST 2013
> ...or, better, remove the if...break and just do:
>
> while users and len(new_message) + len(add) <= MAX_LENGTH:
>
That causes:
Enter string: These are my friends living in the same city as i am. I have
known them for years. They are good people in general. They are:
Traceback (most recent call last):
File "chris_tweet_len.py", line 44, in <module>
print("\n".join(generate_tweets(message, users)))
File "chris_tweet_len.py", line 31, in generate_tweets
while users and len(new_message) + len(add) <= MAX_LENGTH:
UnboundLocalError: local variable 'new_message' referenced before assignment
And the earlier fix now adds two users to a tweet, then one user, then two
user, then one... :(
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20130806/776fc35e/attachment-0001.html>
More information about the Tutor
mailing list