Hi
I would like to edit the string in a give line of string.
But for str3,I dont want to add the spaces at the tailing end knowing the filed format '8'.But I know the field width i.e '8' .Is it possible to add the spaces at the tailing end of the number,without counting the 'digits' and knowing the field format.
Any slicing mechanism or any other idea ,will help me
Thanks
PSB
I would like to edit the string in a give line of string.
Code:
Sample >>> str1 = 'Pnt1 1000 1 2 3 ' >>> str2 = str1[:8] >>> str3 = '2000 ' >>> str4 = str2 + str3 + str1[16:40] >>> str4 'Pnt1 2000 1 2 3 '
Any slicing mechanism or any other idea ,will help me
Thanks
PSB
Comment