I’m sure it is simple, but after googling for a hour (new to python), I’m still not sure what to google to fix my issue 🙁 you can see from my current code and the desired results as to what I am trying to achieve!
Thx
Matt.
Code :
usernames = ['joe', 'john', 'fred']
joe_image = 'c:\aaa\blahblah.jpg'
john_image = 'c:\aaa\foobar.jpg'
fred_image = 'd:\aaa\1234.jpg'
for z in usernames:
print z
y = z + '_image'
print y
Results :
joe
joe_image
john
john_image
fred
fred_image
Desired Results
joe
c:\aaa\blahblah.jpg
john
c:\aaa\foobar.jpg
fred
d:\aaa\1234.jpg
You need something called a Dictionary