生成字典的方法,求快速生成TXT列子。六位数字
想生成 000000 -999999 文本,找了论坛几个,但是生成的速度还是很慢。或者是快速修改字典的方法。比如在 生成A000000
#include <File.au3>
Local $aRecords
If Not _FileReadToArray("A+6位数字.txt", $aRecords) Then
MsgBox(4096, "Error", "error:" & @error)
Exit
EndIf
For $x = 1 To $aRecords
FileWriteLine( "整理完毕.txt","a"&$aRecords[$x]& @CRLF )
Next
MsgBox(0, "完毕", "", 2)
Exit "整理完毕.txt" 应该先FileOpen打开取得其句柄,FileWriteLine 使用句柄写入 回复 2# afan
#include <File.au3>
Local $aRecords
If Not _FileReadToArray("6位数字.txt", $aRecords) Then
MsgBox(4096, "Error", "error:" & @error)
Exit
EndIf
Local $file = FileOpen("整理完毕.txt", 1)
For $x = 1 To $aRecords
FileWriteLine( "整理完毕.txt","A"&$aRecords[$x]& @CRLF )
Next
FileClose($file)
是这样写吗?我试试速度如何。
For $a = 0 To 9
For $b = 0 To 9
For $c = 0 To 9
For $d = 0 To 9
For $e = 0 To 9
For $f = 0 To 9
MsgBox(8096, 'test', $a & $b & $c & $d &$e &$f)
Next
Next
Next
Next
Next
Next 为了达到速度,牺牲CPU ^_^ Global $text = ['A', 'a', 'B', 'b','C' ,'c', '1', '2', '3']
Const $num = Floor(UBound($text) - 1)
Global $a ,$b ,$c ,$d ,$e
For $a = 0 To $num
For $b = 0 To $num
For $c = 0 To $num
For $d = 0 To $num
For $e = 0 To $num
ConsoleWriteError($text[$c] & $text[$b] & $text[$a] & $text[$e] &@CRLF )
;~ FileWrite('text.txt' ,@CRLF & $text[$c] & $text[$b] & $text[$a] & $text[$e])
Next
Next
Next
Next
Next
ConsoleWriteError("在 "& $num & "位 字符'"&$text &"'中共有" &$a * $b *$c * $d * $e & '种组合 可能')
;~ For $a = 0 To 9
;~ For $b = 0 To 9
;~ For $c = 0 To 9
;~ For $d = 0 To 9
;~ For $e = 0 To 9
;~ ConsoleWriteError(@CRLF & $a & $b & $c & $d &$e)
;~ Next
;~ Next
;~ Next
;~ Next
;~ Next
不错,又学到了
页:
[1]