Assigning elements of a python list to a string -
how pass element of list string?
str = categories[0]
thanks.
firstly; in case trying declare "i" string...python weakly typed language means not need declare variable types. instead of writing "int = 5" write "i = 5"
if categories list of strings following:
categories = ["categorya", "categoryb", "categoryc"] = categories[0]
if categories not list of strings want convert value of 1 of index's of categories string following:
categories = [128, 240, 380] = str(categories[0])
if ever need convert int (or possibly convert float) can use
int(i)
or
float(i)
Comments
Post a Comment