了解wiki的统计问卷

待续,尚未写完。

 

wiki问卷:

问题1:您了解wiki (百科)吗?

 

选项

A. 没听说过

B. 没有使用过,仅仅浏览过

C. 不仅使用,而且贡献过词条

D. 对wiki的技术原理、实现等比较清楚

您的选择

 

问题2:某个网站具有站内wiki功能,或者本身就是某一个领域的专业百科网站,您对这种网站什么态度?

 选项

A. 有兴趣

B. 无兴趣

C. 无所谓,不影响我

您的选择

 

问题3. 如果贡献词条,则您愿意贡献词条的原因是:

 

A. 兴趣

B. 成就感

C. 让专业知识得到积累和沉淀

D. 可结识一些志同道合的朋友

E. 即使了解也不想贡献,太麻烦

F. 其它

您的选择

 (可多选)

问题4. 现有wiki网站(如维基百科,baidu,soso百科等)的功能如何?

 选项

A. 很好,完全满足要求

B. 多媒体信息(音视频)更丰富些

C. 词条更专业些

D. 表述更简洁一些,比如通俗易懂些

E. 通过手机更方便快捷地访问

F. 其它

您的选择

 (可多选)

 

如果您对此问卷有任何疑惑或者建议,可以写在下方,谢谢。

 

 

实例数据:

学历行业1234
10bbab
20acff
32bcabcbc
41babcdbd
51bcecd
61aacbd
72bacdb
82baabcdbc
90bcacc
101baebc
112baacbd
121bcababc
132bacc
142baabc
152baacbc
162caaccf
172baaccd
182aade
192baabcbc
201dabcdd
212aade
221bcad

统计程序,前面两道题分别有3个和2个选项,单选。后面两道题均有6个选项,多选。

统计每道题选择a,b,c,d的百分比。很简单的需求。实现如下(发现python中没有自加操作符):

 

 
 
<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> 1 def calc():
2
3 file = open( ' C:\\wiki-query2.txt ' , ' r ' )
4 content = file.read()
5 import re
6 entries = re.split( ' \n+ ' ,content)
7 for entry in entries:
8 if (len(entry) == 0 ):
9 break
10 # print(entry)
11   words = (re.split( ' \t ' ,entry))
12 # words = (str(words)).strip()
13 # print(words[0]+","+words[4])
14 checkSingleChoice(words[ 4 ],answer1)
15 checkSingleChoice(words[ 5 ],answer2)
16 checkMuliChoice(words[ 6 ],answer3)
17 checkMuliChoice(words[ 7 ],answer4)
18
19 file.close()
20 print (answer1)
21 print (answer2)
22 print (answer3)
23 print (answer4)
24 print ( ' the results are: ' )
25 calPercent(answer1, 1 )
26 calPercent(answer2, 2 )
27 calPercent(answer3, 3 )
28 calPercent(answer4, 4 )
29
30
31
32 def checkSingleChoice(item, answer):
33 if item == ' a ' :
34 answer[0] = answer[0] + 1
35 elif item == ' b ' :
36 answer[ 1 ] = answer[ 1 ] + 1
37 elif item == ' c ' :
38 answer[ 2 ] = answer[ 2 ] + 1
39 else :
40 answer[ 3 ] = answer[ 3 ] + 1
41
42 def checkMuliChoice(item, answer):
43 if ' a ' in item:
44 answer[0] = answer[0] + 1
45 if ' b ' in item:
46 answer[ 1 ] = answer[ 1 ] + 1
47 if ' c ' in item:
48 answer[ 2 ] = answer[ 2 ] + 1
49 if ' d ' in item:
50 answer[ 3 ] = answer[ 3 ] + 1
51 if ' e ' in item:
52 answer[ 4 ] = answer[ 4 ] + 1
53 if ' f ' in item:
54 answer[ 5 ] = answer[ 5 ] + 1
55
56
57

 

最终结果:

 

 
 
<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> Type " copyright " , " credits " or " license() " for more information.
>>> ================================ RESTART ================================
>>>
[
4 , 16 , 1 , 1 ]
[
15 , 1 , 6 , 0]
[
12 , 6 , 13 , 6 , 2 , 1 ]
[
1 , 12 , 12 , 7 , 2 , 2 ]
the results are:
Q[
1 ]:
choice[a] :
18.18 % , choice[b] : 72.73 % , choice[c] : 4.55 % , choice[b] : 4.55 % ,
Q[
2 ]:
choice[a] :
68.18 % , choice[b] : 4.55 % , choice[c] : 27.27 % , choice[b] : 0.00 % ,
Q[
3 ]:
choice[a] :
30.00 % , choice[b] : 15.00 % , choice[c] : 32.50 % , choice[b] : 15.00 % , choice[e] : 5.00 % , choice[f] : 2.50 % ,
Q[
4 ]:
choice[a] :
2.78 % , choice[b] : 33.33 % , choice[c] : 33.33 % , choice[b] : 19.44 % , choice[e] : 5.56 % , choice[f] : 5.56 % ,

其中,在统计函数的显示百分比方法中,要设置print结果显示的小数位数,花了些时间找方法,结果:

print(':%.2f' %(p)+'%',end=', '),f表示小数点为是,g表示有效数字位数,e为科学技计数法。

 

 
 
<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> 1 def testDouble():
2 f = 1 / 3
3 print ( ' %.3e %.3f %.3g ' % (f,f,f))
4

 

 
 
<!--<br /><br />Code highlighting produced by Actipro CodeHighlighter (freeware)<br />http://www.CodeHighlighter.com/<br /><br />--> 1 def calPercent(answer,num):
2 count = len(answer)
3 sum = 0
4 percents = []
5 for item in answer:
6 sum += item
7 for item in answer:
8 percent = ((item * 100 ) / sum)
9 percents.append(percent)
10
11 choice = { 1 : ' a ' , 2 : ' b ' , 3 : ' c ' , 4 : ' b ' , 5 : ' e ' , 6 : ' f ' }
12 print ( ' Q[%s]: ' % num)
13 i = 1
14 for p in percents:
15 print ( ' choice[ ' + choice[i] + ' ] ' ,end = ' ' )
16 i += 1
17 print ( ' :%.2f ' % (p) + ' % ' ,end = ' , ' )
18 print ()

 

 

[4, 16, 1, 1]
[15, 1, 6, 0]
[12, 6, 13, 6, 2, 1]
[1, 12, 12, 7, 2, 2]
the results are:
Q[1]:
choice[a] :18.18%, choice[b] :72.73%, choice[c] :4.55%, choice[b] :4.55%, 
Q[2]:
choice[a] :68.18%, choice[b] :4.55%, choice[c] :27.27%, choice[b] :0.00%, 
Q[3]:
choice[a] :30.00%, choice[b] :15.00%, choice[c] :32.50%, choice[b] :15.00%, choice[e] :5.00%, choice[f] :2.50%, 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值