diff --git a/README.md b/README.md index c7aedec..eec2a7f 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,22 @@ ## Python 小脚本,Python版本为3.6 +### 很好用的代理推荐-SmartProxy + +最近发现了一个很好用的代理,给朋友们推荐一下:SmartProxy +主打1亿真实住宅IP资源,专业海外http代理商,千万级优质资源,覆盖全球城市,高匿稳定提供100%原生住宅IP,支持社交账户、电商平台、网络数据收集等服务。 +伪装度很高!本人测试用过之后感觉速度确实嘎嘎快,很给力。 +跨境电商的用户还可以用来tiktok养号,高速解决ip限制问题,可以注册多个账号,高效隐藏用户信息。 +付费套餐选择多样,现在春季价格优惠,动态住宅代理只要65折! +如有这方面需求的,可以注册后联系客服,实名注册后赠送500M流量,不懂怎么用的朋友可以联系客服,中文客服24小时在线,或者看官网的视频教程也行,很多很详细。 + +![](https://image-static.segmentfault.com/131/930/131930173-642ad4d42b5dc_fix732) + +官网链接:[https://www.smartproxy.cn](https://www.smartproxy.cn/regist?invite=7M2ZVK) + +专属注册链接:[https://www.smartproxy.cn/regist?invite=7M2ZVK](https://www.smartproxy.cn/regist?invite=7M2ZVK) + +### 如何安装需要的模块 + 一些第三方模块,需要自行安装,例如安装pymysql,安装方式如下: ``` diff --git "a/\346\213\274\346\216\245\350\241\250\346\240\274\345\215\225\350\241\214\346\225\260\346\215\256\344\270\272\345\255\227\347\254\246\344\270\262/README.md" "b/\346\213\274\346\216\245\350\241\250\346\240\274\345\215\225\350\241\214\346\225\260\346\215\256\344\270\272\345\255\227\347\254\246\344\270\262/README.md" index 281d7f4..d12209e 100644 --- "a/\346\213\274\346\216\245\350\241\250\346\240\274\345\215\225\350\241\214\346\225\260\346\215\256\344\270\272\345\255\227\347\254\246\344\270\262/README.md" +++ "b/\346\213\274\346\216\245\350\241\250\346\240\274\345\215\225\350\241\214\346\225\260\346\215\256\344\270\272\345\255\227\347\254\246\344\270\262/README.md" @@ -1,7 +1,8 @@ ### 文件结构 ``` -├── join_excel_data.py # 拼接Excel表格单行数据 +├── join_excel.py # 拼接Excel表格单行数据(不用引号拼接) +├── join_excel_data.py # 拼接Excel表格单行数据(需要引号拼接) ``` ### 功能描述 diff --git "a/\346\213\274\346\216\245\350\241\250\346\240\274\345\215\225\350\241\214\346\225\260\346\215\256\344\270\272\345\255\227\347\254\246\344\270\262/join_excel.py" "b/\346\213\274\346\216\245\350\241\250\346\240\274\345\215\225\350\241\214\346\225\260\346\215\256\344\270\272\345\255\227\347\254\246\344\270\262/join_excel.py" new file mode 100644 index 0000000..5cf7d22 --- /dev/null +++ "b/\346\213\274\346\216\245\350\241\250\346\240\274\345\215\225\350\241\214\346\225\260\346\215\256\344\270\272\345\255\227\347\254\246\344\270\262/join_excel.py" @@ -0,0 +1,67 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +""" +拼接Excel表格单行数据,并写入文本 +author: gxcuizy +time: 2021-09-24 +""" + +import pandas +import os +import time + + +def print_msg(msg=''): + """打印信息""" + now_time = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime()) + print('[' + now_time + '] ' + msg) + + +# 程序主入口 +if __name__ == "__main__": + # 获取传入参数 + file_input = input('请输入当前目录下的表格文件名(默认“file”):') or 'file' + line_num = input('请输入要拼装的数据第几列(默认“1”):') or '1' + # 判断文件是否存在 + file_name = str(file_input) + '.xlsx' + if os.path.exists(file_name) == False: + file_name = str(file_input) + '.xls' + if os.path.exists(file_name) == False: + + print_msg('文件不存在') + os.system("pause") + exit(0) + # 判断输入的行数是否为数字 + if line_num.isdigit() == False: + print_msg('请输入列数的数字') + os.system("pause") + exit(0) + try: + # 获取表格数据 + print_msg('开始获取文件[' + file_name + ']的第[' + str(line_num) + ']列数据') + line_num = int(line_num) - 1 + sheet = pandas.read_excel(io=file_name, usecols=[line_num], header=None) + data = sheet.values.tolist() + str_data = '' + # 循环处理数据 + print_msg('已获取列数据条数[' + str(len(data)) + '],开始处理数据……') + for x in range(len(data)): + if str(data[x][0]) != 'nan': + # 自动切割最后一个字符串 + row_val = str(data[x][0]) + row_list = row_val.split('/') + row_len = len(row_list) + row_key = row_len - 1 + str_data += str(row_list[row_key]) + "," + # 写入文本文件 + print_msg('数据处理完毕,开始写入……') + log_name = 'str.txt' + with open(log_name, 'w') as f: + f.write(str_data.strip(',')) + print_msg('数据文件[' + log_name + ']写入完毕,请打开查看.') + except Exception as err_info: + # 异常信息 + print_msg(str(err_info)) + # 防止exe程序执行结束闪退 + os.system("pause") diff --git "a/\346\213\274\346\216\245\350\241\250\346\240\274\345\215\225\350\241\214\346\225\260\346\215\256\344\270\272\345\255\227\347\254\246\344\270\262/\350\207\252\345\212\250\351\200\227\345\217\267\346\213\274\346\216\245\350\241\250\346\240\274\345\215\225\350\241\214\346\225\260\346\215\256.exe" "b/\346\213\274\346\216\245\350\241\250\346\240\274\345\215\225\350\241\214\346\225\260\346\215\256\344\270\272\345\255\227\347\254\246\344\270\262/\350\207\252\345\212\250\351\200\227\345\217\267\346\213\274\346\216\245\350\241\250\346\240\274\345\215\225\350\241\214\346\225\260\346\215\256.exe" new file mode 100644 index 0000000..2be3c6b Binary files /dev/null and "b/\346\213\274\346\216\245\350\241\250\346\240\274\345\215\225\350\241\214\346\225\260\346\215\256\344\270\272\345\255\227\347\254\246\344\270\262/\350\207\252\345\212\250\351\200\227\345\217\267\346\213\274\346\216\245\350\241\250\346\240\274\345\215\225\350\241\214\346\225\260\346\215\256.exe" differ