1

I'm a beginner in python, I want to create a string array in python. Is it possible.

we can create integer array like this,

import array as arr
vals = arr.array('i',[8,3,1,5,9,2])

#vals = arr.array('u',['a','e','i','o','u'])
'''
u means unicode character.
'''

print ("The new created array is : ",end="\n") 
for val in vals: 
    print (val, end=' ') 

like the above is possible to create the string array?

import array as arr

vals = arr.array('u', ['TATA Motors','Maruti Suzuki','Hindustan Motors Limited','Ashok Leyland','Mahindra & Chinkara Motors','Opel','Eicher Motors'])

print ("The new created array is : ",end="\n") 
for i in range (0, len(vals)): 
   print (vals[i], end=' ') 

is this possible? if any other possible ways please help me.

AkhilKrishnan
  • 524
  • 5
  • 17

0 Answers0