How to get the first 2 characters from a string in a list and create a new column with it in python? -


apologies first new python , not sure if allowed ask here. trying extract first 2 letter column containing postcodes

i have created list , tried use slicing methods described in documents , whatever find in post here. nearest got reading article 'get first character of first string in list?' able read whole postcode list instead of partial.

for example mylist[3][:2] brings me ['ts3 1hu'] when expecting ab, 4th postcode in list characters upto 2. created list reading file csv module.

can or direct me help? understand concept , can single string when list of strings.

thanks in advance


Comments