ChinaUnix.net
相关文章推荐:

python readlines 去掉换行

文件内容: aa bblllllll ddd python用什么语句可以把“包含bb的行”替换成cc?谢谢

by diyself - Python - 2009-02-23 15:36:54 阅读(5956) 回复(13)

相关讨论

每次换行后都是跳到行首,按空格键几乎可以导致我肌肉劳损。 请问如何配置VIM,可以实现:一般情况下换行后自动帮我输入空格,空格数等于上一行的空格数,如果上一行以 : 号结束的话,空格数等于上一行的空格数+4,刚学VIM没两天,所以提问一个菜鸟问题,望大虾们指教

by luxeeaaa - Python - 2008-10-26 00:00:40 阅读(9064) 回复(14)

1.接收以换行符为结束表示的字符串(服务器端) # -*- coding: cp936 -*- """ 接收以断行符作为结束标识的字符串 为了演示多次接收数据,故意将接收的缓冲区改小为20. 客户端发送的数据长度(以"\n"作为判断长度的表示,而不是NULL)应该大于20 """ import socket import sys host = "" port = 50000 s = socket.socket(socket.AF_INET,socket.SOCK_STREAM) s.bind((host,port)) s.listen(5) while 1: clientsock,clientaddr = s.a...

by jcodeer - Python文档中心 - 2007-10-28 23:30:08 阅读(1528) 回复(0)

python写了一个web服务器日志分析程序类似如下 logfile = open('access.log', 'r') # web服务器的日志文件,这个文件在不断增加新的行 logfile.seek(0, os.SEEK_END) # 我们只关心新产生的日志信息 while True: lines = logfile.readlines() # 读取新产生的日志 for line in lines: item = logline2item(line) # 把当前这一行日志中我们关心的内容用正规分析出来,并存在item这个新的对...

by gnujava - Python - 2009-08-11 19:59:29 阅读(6575) 回复(12)

比如有如下文件: This is the fist line this is second line and with some space in the front hi! I'm the 3rd line! 变成: This is the fist line this is second line and with some space in the front hi! I'm the 3rd line! 谢谢!

by Hex - Python - 2012-05-22 12:51:17 阅读(12708) 回复(10)

Traceback (most recent call last): File "stat_auth.py", line 57, in ? for buff in fLog.readlines():#把radius log的内容保存到rad_log_line数组中 MemoryError 应该是文件过大,读入的行数过多,导致内存不够。 有什么好办法解决吗?

by nnchj - Python - 2008-08-18 11:27:45 阅读(8686) 回复(10)

好好学python,以后要养家吃饭的!!! 本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/89259/showart_1885773.html

by mzlinux - Python文档中心 - 2009-03-31 11:10:31 阅读(1371) 回复(0)

www.okpython.com python中国 这里有教程

by xieaotian - Python - 2009-01-10 12:53:11 阅读(1629) 回复(0)

在系统管理技术手册(第二版)说得很清楚了,perl\python都是不错的啊,学哪个都一样,只要够用就行了,菜鸟学python算了,刚好本站里面又推荐了一本<python核心编程>所以说最好是根据现有的资料学,可能会更顺利些。

by yizuwei520 - C/C++ - 2008-11-24 02:06:34 阅读(1743) 回复(3)

matrix processing for python: NumPy and SciPy. optimized tools: NumPy 方括号[...]定义一个列表,圆括号(...)定义一个元组,花括号{...}定义一个字典: a = [ 1, 3.4, 'hello' ] # A list b = ( 10, 20, 30 ) # A tuple c = { 'a': 3, 'b':42 } # A dictionary 本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u/17420/showart_492068.html

by ariesjzj - Python文档中心 - 2008-03-08 17:35:52 阅读(1389) 回复(0)

lvdbing@ubuntu:~$ python python 2.5.2 (r252:60911, Oct 5 2008, 19:29:17) [GCC 4.3.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> lvdbing@ubuntu:~/python/app/python-3.0$ sudo make fullinstall lvdbing@ubuntu:~$ python python 3.0 (r30:67503, Dec 11 2008, 23:57:39) [GCC 4.3.2] on linux2 Type "help", "copyright", "credits" or "license" for more info...

by lvDbing - Python文档中心 - 2008-12-12 00:00:50 阅读(1878) 回复(0)