-
Notifications
You must be signed in to change notification settings - Fork 0
/
main_func.py
128 lines (118 loc) · 3.92 KB
/
main_func.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
import linecache
import os
import random
file_path = os.path.abspath(os.path.join(os.path.dirname(__file__), 'result'))
## 来点白丝
def give_me_some_bais(num):
txt = open(file_path+'/bais.txt',mode='rb')
data = txt.read().decode('utf-8') # python3一定要加上这句不然会编码报错!
txt.close()
# 获取txt的总行数!
n = data.count('\n')
print("总行数", n)
heis_set = []
# 选取随机的数
for index in range(0,num) :
i = random.randint(1, (n + 1))
print("本次使用的行数", i)
## 得到对应的i行的数据
line=linecache.getline(file_path+'/bais.txt', i).replace("\n",'')
heis_set.append(line)
print(heis_set)
linecache.clearcache()
return heis_set
## 来点黑丝
def give_me_some_heis(num):
txt = open(file_path+'/heis.txt',mode='rb')
data = txt.read().decode('utf-8') # python3一定要加上这句不然会编码报错!
txt.close()
# 获取txt的总行数!
n = data.count('\n')
print("总行数", n)
heis_set = []
# 选取随机的数
for index in range(0,num) :
i = random.randint(1, (n + 1))
print("本次使用的行数", i)
## 得到对应的i行的数据
line=linecache.getline(file_path+'/heis.txt', i).replace("\n",'')
heis_set.append(line)
print(heis_set)
linecache.clearcache()
return heis_set
## 来点足控
def give_me_some_zuk(num):
txt = open(file_path+'/zuk.txt',mode='rb')
data = txt.read().decode('utf-8') # python3一定要加上这句不然会编码报错!
txt.close()
# 获取txt的总行数!
n = data.count('\n')
print("总行数", n)
heis_set = []
# 选取随机的数
for index in range(0,num) :
i = random.randint(1, (n + 1))
print("本次使用的行数", i)
## 得到对应的i行的数据
line=linecache.getline(file_path+'/zuk.txt', i).replace("\n",'')
heis_set.append(line)
print(heis_set)
linecache.clearcache()
return heis_set
## 来点jk
def give_me_some_jk(num):
txt = open(file_path+'/jk.txt',mode='rb')
data = txt.read().decode('utf-8') # python3一定要加上这句不然会编码报错!
txt.close()
# 获取txt的总行数!
n = data.count('\n')
print("总行数", n)
heis_set = []
# 选取随机的数
for index in range(0,num) :
i = random.randint(1, (n + 1))
print("本次使用的行数", i)
## 得到对应的i行的数据
line=linecache.getline(file_path+'/jk.txt', i).replace("\n",'')
heis_set.append(line)
print(heis_set)
linecache.clearcache()
return heis_set
## 来点巨乳
def give_me_some_jur(num):
txt = open(file_path+'/jur.txt',mode='rb')
data = txt.read().decode('utf-8') # python3一定要加上这句不然会编码报错!
txt.close()
# 获取txt的总行数!
n = data.count('\n')
print("总行数", n)
heis_set = []
# 选取随机的数
for index in range(0,num) :
i = random.randint(1, (n + 1))
print("本次使用的行数", i)
## 得到对应的i行的数据
line=linecache.getline(file_path+'/jur.txt', i).replace("\n",'')
heis_set.append(line)
print(heis_set)
linecache.clearcache()
return heis_set
## 来点网红
def give_me_some_mcn(num):
txt = open(file_path+'/mcn.txt',mode='rb')
data = txt.read().decode('utf-8') # python3一定要加上这句不然会编码报错!
txt.close()
# 获取txt的总行数!
n = data.count('\n')
print("总行数", n)
heis_set = []
# 选取随机的数
for index in range(0,num) :
i = random.randint(1, (n + 1))
print("本次使用的行数", i)
## 得到对应的i行的数据
line=linecache.getline(file_path+'/mcn.txt', i).replace("\n",'')
heis_set.append(line)
print(heis_set)
linecache.clearcache()
return heis_set