Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Adding same value to a list 1

Status
Not open for further replies.

plip1978

Technical User
Aug 22, 2007
29
GB
Hi,
I want to add the same value to a list:
Code:
singlevalue = 12
numberOfElements = 60
tempList = [singleValue for i in xrange(numberOfElements)]
This code seems to work, but my IDE reports (quite rightly!) that the variable i is unused. Is there a tidier way to approach this?
Thanks in advance.
 
Excellent, amazingly simple when you know how!
Thanks for this much more elegant solution.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top