In this simple python example:
arr = [1,2,3,4,5]
for n in arr:
s = str(n)
print(s)
What I want to write is a code somehow similar to [str(n) for n in arr]
but in the following format:
arr = [1,2,3,4,5]
for str(n) as s in arr:
print(s)
I basically want to include s=str(s)
inside for
statement. Is the any handy way to do so in python?