Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Please help :)
#10
this is one of the looping techniques available in python. If you have iterable, like list, dict, string, etc. (i.e. any iterable) you can iterate over elements of the iterable using for loop. in this case tweet_txt is just a name (i.e. variable) that takes the value of each of the elements in the list. as you discovered, you can use sentence to the same effect. The important is to use descriptive names when you code.
check this tutorial https://python-forum.io/Thread-Basic-Nev...n-sequence and especially the article linked at the end - https://nedbatchelder.com/text/iter.html

EDIT (02 April 2018) - Ned Batchelder's post/presentation is python2. For changes in dict iteration introduced with python3, please check PEP 469 -- Migration of dict iteration code to Python 3
Reply


Messages In This Thread
Please help :) - by crystalteoh92 - Oct-09-2017, 03:54 AM
RE: Please help :) - by buran - Oct-09-2017, 06:31 AM
RE: Please help :) - by crystalteoh92 - Oct-09-2017, 07:06 AM
RE: Please help :) - by buran - Oct-09-2017, 07:13 AM
RE: Please help :) - by crystalteoh92 - Oct-09-2017, 08:13 AM
RE: Please help :) - by buran - Oct-09-2017, 08:23 AM
RE: Please help :) - by crystalteoh92 - Oct-09-2017, 08:43 AM
RE: Please help :) - by buran - Oct-09-2017, 08:59 AM
RE: Please help :) - by crystalteoh92 - Oct-09-2017, 09:20 AM
RE: Please help :) - by buran - Oct-09-2017, 10:10 AM
RE: Please help :) - by snippsat - Oct-09-2017, 11:49 AM
RE: Please help :) - by buran - Oct-09-2017, 02:00 PM
RE: Please help :) - by crystalteoh92 - Oct-10-2017, 01:04 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020