Python - Extract substrings at fixed offsets

Introduction

We can employ slicing techniques:

Demo

line = 'aaa bbb ccc' 
col1 = line[0:3] # from   ww w  . j  av a  2  s.c o m
col3 = line[8:] 
print( col1 )
print( col3 )

Result

Related Topic