Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Jan 9th, 2007, 9:36 PM   #1
MR.T
Newbie
 
MR.T's Avatar
 
Join Date: Feb 2006
Location: USA,Michigan
Posts: 22
Rep Power: 0 MR.T is on a distinguished road
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
__________________
"Gee, Brain, what do you want to do tonight?" "The same thing we do every night, Pinky: Try to take over the world!"
MR.T is offline   Reply With Quote
Old Jan 9th, 2007, 10:29 PM   #2
Jessehk
The Oblivious One
 
Jessehk's Avatar
 
Join Date: May 2005
Location: Ontario, Canada
Posts: 630
Rep Power: 4 Jessehk is on a distinguished road
You're close.

The correct syntax is
print testlist[1][2]

__________________
Dr. Zoidberg: [ecstatic] I'm going to a movie... with FRIENDS!
Jessehk is offline   Reply With Quote
Old Jan 9th, 2007, 10:52 PM   #3
MR.T
Newbie
 
MR.T's Avatar
 
Join Date: Feb 2006
Location: USA,Michigan
Posts: 22
Rep Power: 0 MR.T is on a distinguished road
^^^^gack, always close but no cigar with me :p. Thank you very much for the help.
__________________
"Gee, Brain, what do you want to do tonight?" "The same thing we do every night, Pinky: Try to take over the world!"
MR.T is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
dev c++ software, template problem cairo C++ 11 Jun 2nd, 2006 12:42 PM
C# corruption!!! Kilo C++ 32 May 21st, 2006 8:44 PM
User-defined creatNode and deleteNode functions for a doubly-linked list jgs C 2 Apr 28th, 2005 8:53 AM
airport Log program using 3D linked List : problem reading from file gemini_shooter C++ 0 Mar 2nd, 2005 4:12 PM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 5:13 PM.

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