Edit to make it better understandable:
My file is looking something like this:
For M5|Adr 11|KD1 12:29:09 1|
For M5|Adr 12|KD1 8964523 12:34:173 1|Lr
For M5|Adr 13|KD1 1000 12:34:563 1|Lv
For M5|Adr 14|KD1 bvff123 12:34:56 1|
For M5|Adr 15|KD1 12:39:063 1|Lr
I found out which lines need to be edited and put them into a list.
templist = list(range(anfzahl+3, endzahl-4))
Templist defines the part of the file which needs to be edited for example: Starting with line 5 until line 15.
The part which needs to be replaced with spaces is for example in this case: 8964523, 1000 and bvff123. There can stand any letter and any number or it can already be blank, it is limited to column 23 to 30 tho.
Now I am looking for a function which can (in this example) edit everything in column 23 to 30 from line 5 to line 15 and replace it with spaces.
Thanks in advance for the read and help.
how about this does this helps
some_list = [
"For M5|Adr 11|KD1 12:29:09 1|",
"For M5|Adr 12|KD1 8964523 12:34:173 1|Lr",
"For M5|Adr 13|KD1 1000 12:34:563 1|Lv",
"For M5|Adr 14|KD1 bvff123 12:34:56 1|",
"For M5|Adr 15|KD1 12:39:063 1|Lr"
]
some_str = some_list[1].replace("8964523", '')
some_list[1] = some_str
print(some_list)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.