Skip to content

更新一个补丁 #13

@jingyuexing

Description

@jingyuexing
---
 update_chunzhen.py | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)

diff --git a/update_chunzhen.py b/update_chunzhen.py
index 54e3939..064843e 100644
--- a/update_chunzhen.py
+++ b/update_chunzhen.py
@@ -103,14 +103,18 @@ def updateQQwry(filename):
         return -6
 
 if __name__ == '__main__':
-    import sys
-    if len(sys.argv) > 1:
-        ret = updateQQwry(sys.argv[1])
+    import argparse
+    argumentParser = argparse.ArgumentParser("download cz IP data")
+
+    argumentParser.add_argument("--file",help="download file of name",type=str)
+
+    args = argumentParser.parse_args()
+    print('args',args)
+    if(args.file != None):
+        ret = updateQQwry(f'{args.file}.dat')
         if ret > 0:
             print('成功更新到%s,%s字节' % 
-                  (sys.argv[1], format(ret, ','))
+                  (args.file, format(ret, ','))
                   )
         else:
-            print('更新失败,错误代码:%d' % ret)
-    else:
-        print('用法:以想要保存的文件名作参数。')
+            print('更新失败,错误代码:%d' % ret)
\ No newline at end of file
-- 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions