1. 使用iter实现接收用户多行输入 stopword = '' str = '' print('请将要添加的内容输入下方,输入空白行按回车退出程序:') for line in iter(input,stopword): str += line + '\n' with open('config','a') as f: f.write(str) return 'OK' 2. python string和dict转换 字典(dict)转为字符串(string) 我们可以比较容易的将字典(di
[问题描述] 在将dict转为DataFrame时会报错:If using all scalar values, you must pass an index 例如: summary = pd.DataFrame({key:value for key,value in test.items()if key in index}) #查看汇总表情况 [解决办法] 添加参数:index = [0] summary = pd.DataFrame({key:value for key,value in t
word '\xe8\xb6\x85\xe8\x87\xaa\xe7\x84\xb6\xe7\x8e\xb0\xe8\xb1\xa1' not in vocabulary 分词后的样本格式:英雄联盟,疾风剑豪-亚索,五杀,精彩操作长安外传,街头采访,神回复日本料理,蛋包饭滑板运动,极限达人,城会玩 LineSentence u'王者荣耀'print(model[u'王者荣耀'])print(model[u'超自然现象']) python保存numpy数据numpy.savetxt("result