Reading a file and then writing something back

Byron DesertLinux at netscape.net
Wed Jul 21 13:57:32 EDT 2004


Opps, forgot to add one extra thing:
--------------------------------------------

If you would like to see all of the names from your "names" list, you 
can do the following:

	for name in names:
		print name


This provides you with the results:

	Dan
	Kevin
	Pat
	Steven
	Tony
	William


---

If you would like to see the first and fourth items in the list, you can 
do the following:

	print names[0]			# Display the first item in the list.  First item 
always starts with zero.
	print names[3]			# Display the fourth item in the list.

Result is:

	Dan
	Steven

---

Finally, if you would like to remove an item from the list:

	del names[3]

---

Hope this helps!

Byron
----------------------------



More information about the Python-list mailing list