从头开始做了一个小工具,花了半天时间。
另外整合pyQT做的前端UI。
最后用pyinstaller打包成一个exe文件。
最后一列之前要插入随机字符,然后把所有列拼接程一列。
核心代码如下:
sourcepath="template.xlsx"
outputpath="excel2txt.txt"
ifself.txtSourcePath.toPlainText().strip()!="":
sourcepath=self.txtSourcePath.toPlainText()
print(sourcepath)
ifself.txtDestionPath.toPlainText().strip()!="":
outputpath=self.txtDestionPath.toPlainText()
print(outputpath)
#dfSC= pd.read_excel("specialCharacters.xlsx")
#arrSC = dfSC.loc[:,['特殊符号']].values.flatten()
df=pd.read_excel(sourcepath)
#print(df.dropna(how = 'all',axis=1))
df2=pd.DataFrame([rforrinits.product(df.标题, df.内容, df.标签, df.地区, df.联系方式, df.超链接文本)],columns=df.columns)
df_new=df2.dropna().reset_index(drop=True)
#print(df_new)
df_new.insert(5,"randSpecCharacterCol", np.random.choice(arrSC, df_new.shape[0]),True)
df1column=df_new.astype(str).sum(1)
df1column.to_csv(outputpath,sep=',',index=False)
#print(df1column)
实现效果
标题 内容 标签 地区 联系方式 超链接文本
0 A1 B1 C1 D1 H1 HTTP1
1 A2 B2 C2 D2 H2 HTTP2
2 A3 B3 C3 D3 NaN HTTP3
3 A4 B4 C4 NaN NaN HTTP4
4 A5 NaN C5 NaN NaN HTTP5
5 A6 NaN C6 NaN NaN HTTP6
6 A7 NaN NaN NaN NaN HTTP7
7 A8 NaN NaN NaN NaN HTTP8
8 NaN NaN NaN NaN NaN HTTP9
9 NaN NaN NaN NaN NaN HTTP10
10 NaN NaN NaN NaN NaN HTTP11
11 NaN NaN NaN NaN NaN HTTP12
12 NaN NaN NaN NaN NaN HTTP13
13 NaN NaN NaN NaN NaN HTTP14
标题 内容 标签 地区 联系方式 超链接文本
0 A1 B1 C1 D1 H1 HTTP1
1 A1 B1 C1 D1 H1 HTTP2
2 A1 B1 C1 D1 H1 HTTP3
3 A1 B1 C1 D1 H1 HTTP4
4 A1 B1 C1 D1 H1 HTTP5
5 A1 B1 C1 D1 H1 HTTP6
6 A1 B1 C1 D1 H1 HTTP7
7 A1 B1 C1 D1 H1 HTTP8
8 A1 B1 C1 D1 H1 HTTP9
9 A1 B1 C1 D1 H1 HTTP10
10 A1 B1 C1 D1 H1 HTTP11
11 A1 B1 C1 D1 H1 HTTP12
12 A1 B1 C1 D1 H1 HTTP13
13 A1 B1 C1 D1 H1 HTTP14
14 A1 B1 C1 D1 H2 HTTP1
15 A1 B1 C1 D1 H2 HTTP2
16 A1 B1 C1 D1 H2 HTTP3
17 A1 B1 C1 D1 H2 HTTP4
18 A1 B1 C1 D1 H2 HTTP5
19 A1 B1 C1 D1 H2 HTTP6
20 A1 B1 C1 D1 H2 HTTP7
21 A1 B1 C1 D1 H2 HTTP8
22 A1 B1 C1 D1 H2 HTTP9
23 A1 B1 C1 D1 H2 HTTP10
24 A1 B1 C1 D1 H2 HTTP11
25 A1 B1 C1 D1 H2 HTTP12
26 A1 B1 C1 D1 H2 HTTP13
27 A1 B1 C1 D1 H2 HTTP14
28 A1 B1 C1 D2 H1 HTTP1
29 A1 B1 C1 D2 H1 HTTP2
... .. .. .. .. ... ...
16098 A8 B4 C6 D2 H2 HTTP13
16099 A8 B4 C6 D2 H2 HTTP14
16100 A8 B4 C6 D3 H1 HTTP1
16101 A8 B4 C6 D3 H1 HTTP2
16102 A8 B4 C6 D3 H1 HTTP3
16103 A8 B4 C6 D3 H1 HTTP4
16104 A8 B4 C6 D3 H1 HTTP5
16105 A8 B4 C6 D3 H1 HTTP6
16106 A8 B4 C6 D3 H1 HTTP7
16107 A8 B4 C6 D3 H1 HTTP8
16108 A8 B4 C6 D3 H1 HTTP9
16109 A8 B4 C6 D3 H1 HTTP10
16110 A8 B4 C6 D3 H1 HTTP11
16111 A8 B4 C6 D3 H1 HTTP12
16112 A8 B4 C6 D3 H1 HTTP13
16113 A8 B4 C6 D3 H1 HTTP14
16114 A8 B4 C6 D3 H2 HTTP1
16115 A8 B4 C6 D3 H2 HTTP2
16116 A8 B4 C6 D3 H2 HTTP3
16117 A8 B4 C6 D3 H2 HTTP4
16118 A8 B4 C6 D3 H2 HTTP5
16119 A8 B4 C6 D3 H2 HTTP6
16120 A8 B4 C6 D3 H2 HTTP7
16121 A8 B4 C6 D3 H2 HTTP8
16122 A8 B4 C6 D3 H2 HTTP9
16123 A8 B4 C6 D3 H2 HTTP10
16124 A8 B4 C6 D3 H2 HTTP11
16125 A8 B4 C6 D3 H2 HTTP12
16126 A8 B4 C6 D3 H2 HTTP13
16127 A8 B4 C6 D3 H2 HTTP14
[16128 rows x 6 columns]
0 A1B1C1D1H1◯HTTP1
1 A1B1C1D1H1◚HTTP2
2 A1B1C1D1H1∺HTTP3
3 A1B1C1D1H1⊇HTTP4
4 A1B1C1D1H1∽HTTP5
5 A1B1C1D1H1⊆HTTP6
6 A1B1C1D1H1≓HTTP7
7 A1B1C1D1H1∺HTTP8
8 A1B1C1D1H1≋HTTP9
9 A1B1C1D1H1≋HTTP10
10 A1B1C1D1H1≌HTTP11
11 A1B1C1D1H1≰HTTP12
12 A1B1C1D1H1≭HTTP13
13 A1B1C1D1H1⊃HTTP14
14 A1B1C1D1H2◠HTTP1
15 A1B1C1D1H2≡HTTP2
16 A1B1C1D1H2∴HTTP3
17 A1B1C1D1H2∩HTTP4
18 A1B1C1D1H2≻HTTP5
19 A1B1C1D1H2◨HTTP6
20 A1B1C1D1H2≲HTTP7
21 A1B1C1D1H2≜HTTP8
22 A1B1C1D1H2∓HTTP9
23 A1B1C1D1H2∠HTTP10
24 A1B1C1D1H2◛HTTP11
25 A1B1C1D1H2◮HTTP12
26 A1B1C1D1H2≶HTTP13
27 A1B1C1D1H2∸HTTP14
28 A1B1C1D2H1∽HTTP1
29 A1B1C1D2H1◙HTTP2
...
16098 A8B4C6D2H2⊉HTTP13
16099 A8B4C6D2H2◞HTTP14
16100 A8B4C6D3H1◪HTTP1
16101 A8B4C6D3H1≅HTTP2
16102 A8B4C6D3H1≌HTTP3
16103 A8B4C6D3H1∈HTTP4
16104 A8B4C6D3H1∴HTTP5
16105 A8B4C6D3H1∤HTTP6
16106 A8B4C6D3H1∍HTTP7
16107 A8B4C6D3H1⊑HTTP8
16108 A8B4C6D3H1≋HTTP9
16109 A8B4C6D3H1∼HTTP10
16110 A8B4C6D3H1≾HTTP11
16111 A8B4C6D3H1∱HTTP12
16112 A8B4C6D3H1◫HTTP13
16113 A8B4C6D3H1≉HTTP14
16114 A8B4C6D3H2≋HTTP1
16115 A8B4C6D3H2∬HTTP2
16116 A8B4C6D3H2∥HTTP3
16117 A8B4C6D3H2≖HTTP4
16118 A8B4C6D3H2∭HTTP5
16119 A8B4C6D3H2∊HTTP6
16120 A8B4C6D3H2∺HTTP7
16121 A8B4C6D3H2≵HTTP8
16122 A8B4C6D3H2∘HTTP9
16123 A8B4C6D3H2◢HTTP10
16124 A8B4C6D3H2⊌HTTP11
16125 A8B4C6D3H2≄HTTP12
16126 A8B4C6D3H2∌HTTP13
16127 A8B4C6D3H2∦HTTP14
Length: 16128, dtype: object
具体内容请看
https://github.com/vankiaio/PermutationsTools
打包exe请看
https://blog.csdn.net/zhangyu4863/article/details/81267779