def f(a, b,c,d):
x = open('data.txt', 'r')
for line in x:
line = line[a:b] + ':' + line[c:d] + ':'
x2 = open('data2.txt', 'a+')
x2.writelines(line)
f(0,2,2,6)
I have raw data which is something like
1231231231231233453453223768729318974389124387\n
1234534534534543242145791208937867328918373892\n
8765432456765434568987692839471281027128012398\n
5787624567456787432343512487320190928390129383\n
I want to divide data based on their location
for example: [0:2]
could be column 1 and [2:6]
is column 2 and so on.
when I'm calling the function f()
, Is there any way in python where we can overload or dynamically enter parameters like
f(0,2,2,6,6,10,10,14.......)
output:
57:8762:4567:8743.....