+ 2

How can I print two or more strings in a same list?

for example: things=["spam",0,2] print(things[0][1][3]) #i know, its wrong '[3]' #expect results: p,m

2nd Aug 2017, 3:36 PM
Gilver!
Gilver! - avatar
2 Antworten
+ 6
You can either enumerate them (if you have to have them printed after a comma) or try a proper slicing technique: things=["spam",0,2] print(things[0][1::2]) # pm
2nd Aug 2017, 3:41 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar
+ 3
thanks for help!
2nd Aug 2017, 3:52 PM
Gilver!
Gilver! - avatar