PTT
Submit
Submit
選擇語言
正體中文
简体中文
PTT
Python
[問題]想請教一個有關特定行數插入的問題
作者:
alex711202
(David)
2019-03-22 17:39:45
問題如下,
如果有一個檔案,內容為要插入特定字串的行數。
100
200
300
400
.
.
.etc
接下來要在另一個檔案的特定行數插入特定字串。
xxxxxxxxxxxxxxxxxx '100
-> insert string
.
.
.
xxxxxxxxxxxxxxxxxx '200
-> insert string
.
.
.
xxxxxxxxxxxxxxxxxx '300
-> insert string
有高手可以分享解法嗎,謝謝
作者:
froce
(froce)
2019-03-22 18:24:00
最笨的方法就讀進list,改掉想要的元素,丟回原檔
作者:
lemon651
(小明)
2019-03-22 20:22:00
讀進list再插效率不好,不如開一個新的list全部掃一遍重插
繼續閱讀
[問題] import觀念問題請教
yimean
[問題] 老程式打包移轉問題
chang0206
Re: [問題] 出現unhashable type: 'list'該如何處理
as30385438
[問題] 正則表達分割字串(已解決)
silverair
[問題] 出現unhashable type: 'list'該如何處理
qzxwec789
[問題] 繩子減半
qokey0817
[問題]flask搭配uwsgi使用問題
michael3941
[問題] zip()在python2、python3官方文件問題
laughingman
[問題] matplotlib.pyplot關不起來
alen84204
flask_restful post file問題請教
buddy66
Links
booklink
Contact Us: admin [ a t ] ucptt.com