我正在從文件中切出一大塊文本。現在塊存儲在一個變量中。像,從大字符串讀取行
str="from child hood days i liked sweet and savoir. in the early days my mother cooked great deal of sweet meats in home and all my relatives had a nice taste for good sweets. even in remote assam town we thronged miles to procure good sweets. and my sweet eating habit was pretty known. in my childhood i could had as good as 30 to 40 rosgollas at one seating after a full course of lunch. though i was not among the best in my family."
但我現在想讀的每一行以同樣的方式,因爲我們寫的
for line in file:
print line
我的問題是,我們能做到這一點,或者我應該寫回文件,然後做手術?如果任何人都可以提供幫助。
問候, Subhabrata班納吉 古爾岡印度
如果你想讀的每一行,剛讀從文件中的行線。 – Sterling 2012-07-05 15:46:14