2006年09月28日 星期四 12:49
我想用PYTHON处理 一些文本文件的读写, 请问哪里有好的例子? 多谢!
2006年09月28日 星期四 12:57
Hi linda.s: <>好像不错。 这里下载 http://www.miex.org/python/ linda.s 写道: > 我想用PYTHON处理 > 一些文本文件的读写, > 请问哪里有好的例子? > 多谢! > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese -- Best regards! Kasicass/sYcini - Coder http://www.sycini.com
2006年09月28日 星期四 13:08
如果文件比较小的话 , 可以一次读进来, 按照 字符串, 处理. 也就是 处理 字符串的 那些方法, 复杂点的 , 可能 用到 正则表达式, 再复杂的 , 象计算机语言,这种文本, 有逻辑的, 就麻烦了, 但是,很少见了, 不是程序员, 写不出这种东西 On 9/28/06, linda. s <samrobertsmith at gmail.com> wrote: > 我想用PYTHON处理 > 一些文本文件的读写, > 请问哪里有好的例子? > 多谢!
2006年09月28日 星期四 23:22
f=file(r'输入文件.txt','f')
for line in f:
print line
On 9/28/06, lu <lubiao.py在gmail.com> wrote:
>
> 如果文件比较小的话 , 可以一次读进来,
> 按照 字符串, 处理.
>
> 也就是 处理 字符串的 那些方法,
> 复杂点的 , 可能 用到 正则表达式,
>
> 再复杂的 , 象计算机语言,这种文本, 有逻辑的, 就麻烦了, 但是,很少见了, 不是程序员, 写不出这种东西
>
> On 9/28/06, linda. s <samrobertsmith在gmail.com> wrote:
> > 我想用PYTHON处理
> > 一些文本文件的读写,
> > 请问哪里有好的例子?
> > 多谢!
> _______________________________________________
> python-chinese
> Post: send python-chinese在lists.python.cn
> Subscribe: send subscribe to python-chinese-request在lists.python.cn
> Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
--
Linker M Lin
linkerlin88在gmail.com
linker.m.lin在gmail.com
※※※※※※※※※
※※我思故我在※※
※※※※※※※※※
-------------- 下一部分 --------------
一个HTML附件被移除...
URL: http://python.cn/pipermail/python-chinese/attachments/20060928/a31a7716/attachment.html
2006年09月28日 星期四 23:22
f=file(r'输入文件.txt','r')
for line in f:
print line
On 9/28/06, Linker Lin <linkerlin88在gmail.com> wrote:
>
> f=file(r'输入文件.txt','f')
>
> for line in f:
> print line
>
> On 9/28/06, lu <lubiao.py在gmail.com> wrote:
> >
> > 如果文件比较小的话 , 可以一次读进来,
> > 按照 字符串, 处理.
> >
> > 也就是 处理 字符串的 那些方法,
> > 复杂点的 , 可能 用到 正则表达式,
> >
> > 再复杂的 , 象计算机语言,这种文本, 有逻辑的, 就麻烦了, 但是,很少见了, 不是程序员, 写不出这种东西
> >
> > On 9/28/06, linda. s < samrobertsmith在gmail.com> wrote:
> > > 我想用PYTHON处理
> > > 一些文本文件的读写,
> > > 请问哪里有好的例子?
> > > 多谢!
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese在lists.python.cn
> > Subscribe: send subscribe to python-chinese-request在lists.python.cn
> > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
>
>
>
>
> --
> Linker M Lin
> linkerlin88在gmail.com
> linker.m.lin在gmail.com
> ※※※※※※※※※
> ※※我思故我在※※
> ※※※※※※※※※
--
Linker M Lin
linkerlin88在gmail.com
linker.m.lin在gmail.com
※※※※※※※※※
※※我思故我在※※
※※※※※※※※※
-------------- 下一部分 --------------
一个HTML附件被移除...
URL: http://python.cn/pipermail/python-chinese/attachments/20060928/54cf9c25/attachment.htm
2006年09月30日 星期六 14:48
正则表达式在PYTHON上的使用能给个例子吗?我知道有个re模块,但是很难看懂. On 9/28/06, Linker Lin <linkerlin88在gmail.com> wrote: > f=file(r'输入文件.txt','r') > > for line in f: > print line > > > On 9/28/06, Linker Lin <linkerlin88在gmail.com > wrote: > > f=file(r'输入文件.txt','f') > > > > for line in f: > > print line > > > > > > > > On 9/28/06, lu < lubiao.py在gmail.com> wrote: > > > 如果文件比较小的话 , 可以一次读进来, > > > 按照 字符串, 处理. > > > > > > 也就是 处理 字符串的 那些方法, > > > 复杂点的 , 可能 用到 正则表达式, > > > > > > 再复杂的 , 象计算机语言,这种文本, 有逻辑的, 就麻烦了, 但是,很少见了, 不是程序员, 写不出这种东西 > > > > > > On 9/28/06, linda. s < samrobertsmith在gmail.com> wrote: > > > > 我想用PYTHON处理 > > > > 一些文本文件的读写, > > > > 请问哪里有好的例子? > > > > 多谢! > > > _______________________________________________ > > > python-chinese > > > Post: send python-chinese在lists.python.cn > > > Subscribe: send subscribe to > python-chinese-request在lists.python.cn > > > Unsubscribe: send unsubscribe to > python-chinese-request在lists.python.cn > > > Detail Info: > http://python.cn/mailman/listinfo/python-chinese > > > > > > > > -- > > Linker M Lin > > linkerlin88在gmail.com > > linker.m.lin在gmail.com > > ※※※※※※※※※ > > ※※我思故我在※※ > > ※※※※※※※※※ > > > > -- > Linker M Lin > linkerlin88在gmail.com > linker.m.lin在gmail.com > ※※※※※※※※※ > ※※我思故我在※※ > ※※※※※※※※※ > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to > python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to > python-chinese-request在lists.python.cn > Detail Info: > http://python.cn/mailman/listinfo/python-chinese >
2006年09月30日 星期六 16:29
建议仔细阅读《Perl语言入门》中讲述正则表达式的章节,对于入门很有帮助。不要把正则表达式模块的使用和正则表达式本身混淆。 -- GoogleTalk: qcxhome at gmail.com MSN: qcxhome at hotmail.com My Space: tkdchen.spaces.live.com BOINC: boinc.berkeley.edu 中国分布式计算总站: www.equn.com
Zeuux © 2025
京ICP备05028076号