Python - Extract substrings at fixed offsets

Introduction

We can employ slicing techniques:

Demo

line = 'aaa bbb ccc' 
col1 = line[0:3] #  w w w  .ja v a2  s  .co m
col3 = line[8:] 
print( col1 )
print( col3 )

Result

Related Topic