易截截图软件、单文件、免安装、纯绿色、仅160KB

用 Python 3 写的命令行百度词典

今天是第二天自己看关于Python了,看见一个Python2写的百度词典,我也用Python 3 写了一个。真的很小巧,呵呵,很好的语言。
不知道怎么上传代码格式的,就上传文本了:
# -*- coding: utf8 -*-
import urllib.parse
import urllib.request
def search(word):
    #word = input("输入你要查询的单词:")
    url="http://m.baidu.com/s?word="+word+"&ssid=0&from=0&bd_page_type=1&uid=frontui_1273397350_2416&mark=3"
    s = (urllib.request.urlopen(url).read()).decode("UTF-8")
    p=s[s.find("<div>")+5:s.find("</div>")-12]
    q=p.split("<br/>")
    for i in range(0,len(q)):
        q[i]=q[i][0:(q[i].find("[<img"))]
        q[i]=q[i][0:(q[i].find("<img"))]
        print(q[i])
    search(input("输入你要查询的单词:"))
   
search(input("输入你要查询的单词:"))
22:27:40


相关文档:

python的变参


python的变参
*args和**dargs是Python的两个可
变参数,两者有所不同的是*args是个tuple,**dargs是个dict。
*args
和**dargs并用时,*args必须放在**dargs的前面。
例如:
def func(a,b, *c):
    pass
函数func至少有两个参数变参数放在tuple  c中
def func(*c): 或者 def  func(**d ......

Install Python + Eric IDE


Install Python Eric IDE
1 Download following things
 
1) Python3.1
 
2) PyQt for python 3.1
(http://www.riverbankcomputing.co.uk/software/pyqt/download) I am using
PyQt-Py3.1-gpl-4.7.3-2.exe
 
3) Eric5 IDE
(http://eric-ide.python-projects.org/eric-download.html)
 
2 ......

python 笔记 for loop and extend, append

list.append(item)
list.extend(sequence)
http://docs.python.org/tutorial/datastructures.html
http://docs.python.org/library/functions.html 这几天看一下
python howto
恩。python documentation 确实很好很强大啊!
list.append(x)Add an item to the end of the list; equivalent to a[len(a):]&n ......

[原创]Python(pysvn)提取svn版本间改动文件列表

[原创]Python(pysvn)提取svn版本间改动文件列表
by AKara 2010.04.29 @ http://blog.csdn.net/akara @ akaras@163.com
---------------------------------------------------------------------
 
  希望实现一个提取两个svn revision间有变动(增/删/改)的文件的列表
的命令行工具;可以帮我们项目做一些流 ......

在ubuntu上编译vim并带有python支持

ubuntu10.05出来了这两天一直在折腾,显示wubi无反应,然后从硬盘安装期间又遇到grub错误等问题。安装成功后搞个中文输入法就老半天,最后使用Pinyin这个还算好用,有点想搜狗就是没什么词库。最恶心的还是vim的问题,用apt-get install vim装的vim不支持系统剪切板,只好从源代码编译,可是我尝试了很多次总是没有python支 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号