1.记录一下Python
保存字符串到文件的方法:
def save_to_file(file_name, contents):
fh = open(file_name, 'w')
fh.write(contents)
fh.close()
save_to_file('mobiles.txt', 'your contents str')
2.
dir() 函数
dir([object]) 会返回object所有有效的属性列表。示例如下:
$ python
Python 2.7.8 (default, Sep 24 2015, 18:26:19)
[GCC 4.9.2 20150212 (Red Hat 4.9.2-6)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> mser = cv2.MSER()
>>> dir(mser)
['__class__', '__delattr__', '__doc__', '__format__', '__getattribute__', '__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'detect', 'empty', 'getAlgorithm', 'getBool', 'getDouble', 'getInt', 'getMat', 'getMatVector', 'getParams', 'getString', 'paramHelp', 'paramType', 'setAlgorithm', 'setBool', 'setDouble', 'setInt', 'setMat', 'setMatVector', 'setString']
3.jieba分词
pip intall jieba
1,下载
https://www.lfd.uci.edu/~gohlke/pythonlibs/#wordcloud
2,安装 (window环境安装)
找的下载文件的路径
安装
1 |
|
3,验证是否安装成功
添加英文数据的文件,比如我的是testfile.txt
文件内容为英文,比如
Devouring Time, blunt thou the lion's paws, And make the earth devour her own sweet brood; Pluck the keen teeth from the fierce tiger's jaws, And burn the long-lived phoenix in her blood; 。。。。。。。。
运行python:
1 2 3 4 5 6 7 8 9 10 |
|
结果
哈哈哈哈,就这么解决了。。。双击66666666666666666666666666666666666666