Right I am a complete beginner here, trying to work through various python tutorials and a lot of them are great. However none of them have much of a consolidated approach to learning, where one skill builds on another. They all seem to show you things in silo. All I am trying to do is concatenate a string with an integer that is held in an array. Here is the code:
text = 'product_price_'
numberArray = [1,2,3,4,5,6,7,8,9,10]
for i in numberArray:
print text + str(numberArray[i])
This kind of works, giving me the result:
product_price_2
product_price_3
product_price_4
product_price_5
product_price_6
product_price_7
product_price_8
product_price_9
product_price_10
Traceback (most recent call last):
File "/Users/me/Documents/Programming/python/eclipse/workspace/concat.py", line 8, in <module>
print text + str(numberArray[i])
IndexError: list index out of range
Like I say this is really simple stuff. I can concatenate, I can print an array but do both??
Can anyone plug this gap in my knowledge for me?
Thanks
i. You're not showing all of the code in your script. Please be sure to include line #8 (the one named in the error message).