-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtxt_gen.py
62 lines (61 loc) · 1.9 KB
/
txt_gen.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
import random
dir_txt = './'
with open(dir_txt+'defp.txt','w') as f:
for i in range(100000):
len_nums = random.randint(10,15)
line = ":"+"发票代码"###
for j in range(len_nums):
line = line+str(random.randint(0,9))
line = line+'\n'
f.write(line)
len_nums = random.randint(6,8)
line = ":"+"发票号码"###
for j in range(len_nums):
line = line+str(random.randint(0,9))
line = line+'\n'
f.write(line)
prs = random.random()
if prs < 0.1:
if random.random()<0.5:
zwname = "壹佰元"
else:
zwname = "壹佰元整"
elif prs >0.1 and prs<0.2:
if random.random()<0.5:
zwname = "贰佰元"
else:
zwname = "贰佰元整"
elif prs >0.2 and prs<0.3:
if random.random()<0.5:
zwname = "伍拾元"
else:
zwname = "伍拾元整"
elif prs >0.5 and prs<0.6:
if random.random()<0.5:
zwname = "壹拾元"
else:
zwname = "壹拾元整"
elif prs >0.3 and prs<0.4:
if random.random() < 0.7:
zwname = "拾元整"
else:
zwname = "拾元"
elif prs >0.4 and prs<0.5:
zwname = "壹元整"
elif prs >0.6 and prs<0.7:
if random.random()<0.5:
zwname = "贰拾元"
else:
zwname = "贰拾元整"
elif prs >0.7 and prs<0.8:
zwname = "贰元整"
elif prs >0.8 and prs<0.9:
zwname = "伍元整"
else:
if random.random()<0.5:
zwname = "壹佰元"
else:
zwname = "壹佰元整"
line = ":"+zwname###
line = line+'\n'
f.write(line)