List Index Question

Thread Solved
Reply

Join Date: Sep 2008
Posts: 76
Reputation: SoulMazer is an unknown quantity at this point 
Solved Threads: 1
SoulMazer SoulMazer is offline Offline
Junior Poster in Training

List Index Question

 
0
  #1
Nov 10th, 2008
First off, I know that to set an indexed variable, say, mylist[3] = "Hello". I also know that you wouldn't be able to set mylist[3] if you didn't first state:

[code = python]mylist = ["Whatever", "Whatever", "Whatever", "Whatever"][/code]

But, if you had a variable with an extremely large index, it would be a pain in the rear to type " "Whatever", " that many times.

So, my question is, is there a not-tedious way to do this? Like Ruby's mylist = "Whatever" * 100?

Thanks in advance.
Reply With Quote Quick reply to this message  
Join Date: Jul 2008
Posts: 838
Reputation: Gribouillis has a spectacular aura about Gribouillis has a spectacular aura about Gribouillis has a spectacular aura about 
Solved Threads: 192
Gribouillis's Avatar
Gribouillis Gribouillis is offline Offline
Practically a Posting Shark

Re: List Index Question

 
0
  #2
Nov 10th, 2008
this way
  1. mylist = ["whatever"] * 100
Reply With Quote Quick reply to this message  
Join Date: Sep 2008
Posts: 76
Reputation: SoulMazer is an unknown quantity at this point 
Solved Threads: 1
SoulMazer SoulMazer is offline Offline
Junior Poster in Training

Re: List Index Question

 
0
  #3
Nov 10th, 2008
Problem solved. Thanks a lot.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC