Programming Forums

Programming Forums (http://www.programmingforums.org/forumindex.php)
-   Python (http://www.programmingforums.org/forum43.html)
-   -   Printing part of a string from a list (http://www.programmingforums.org/showthread.php?t=12339)

MR.T Jan 9th, 2007 10:36 PM

Printing part of a string from a list
 
:

testlist = ["Programming", "Forums"]
I want to print just the 3rd letter in the second cell of the list. I have tried this:
:

print testlist[1[2]]
But that does'nt work, I get a error saying "unsubscriptable object". What am I doing wrong?

Thanks

Jessehk Jan 9th, 2007 11:29 PM

You're close.

The correct syntax is
:

print testlist[1][2]

:)

MR.T Jan 9th, 2007 11:52 PM

^^^^gack, always close but no cigar with me :p. Thank you very much for the help.


All times are GMT -5. The time now is 1:50 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC