批量转换Python2代码到Python3代码的bat脚本
发表于|更新于|python
|浏览量:
批量转换Python2代码到Python3代码的bat脚本
2o3.bat1
2
3
4
5@echo off
for /r ./ %%i in (*.py) do (
c:\Python27\python.exe c:\Python27\Tools\Scripts\2to3.py -w %%i
echo %%i
)
文章作者: 火苗
版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 火苗的博客!
相关推荐

2022-11-09
python监视ubuntu目录
python监视ubuntu目录EventHandler类的函数重载process_后面加上下面的内容,需要那个功能就重载那个函数。 事件类型 说明 IN_ACCES 文件被访问 IN_MODIFY|文件被修改IN_ATTRIB|文件属性被修改IN_CLOSE_WRITE|以可写方式打开的文件被关闭IN_CLOSE_NOWRITE|以不可写方式打开的文件被关闭IN_OPEN|文件被打开IN_MOVED_FROM|文件被移出监控的目录IN_MOVED_TO|文件被移入监控着的目录IN_CREATE|在监控的目录中新建文件或子目录IN_DELETE|文件或目录被删除IN_DELETE_SELF|自删除,即一个可执行文件在执行时删除自己IN_MOVE_SELF|自移动,即一个可执行文件在执行时移动自己 代码1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697...

2022-11-09
python连接mysql
python连接mysqlpython连接mysql的例子。 mysql不使用默认端口号时,修改db_port为mysql的端口。 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354import pymysqldb_port = 3306db_charset = 'utf8'db_name = 'testdb'db_host = '127.0.0.1'db_user_name = 'flame'db_user_pwd = 'flame999'cx = pymysql.connect(host=db_host, user=db_user_name, password=db_user_pwd, database=db_name, charset=db_charset, port=db_port)# execute sqldef execut...

2022-10-18
python解析命令行参数
python使用getopt和sys解析命令行参数python例子12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667#!/usr/bin/python3# -*- coding: utf-8 -*-import sysimport getoptimport osimport tarfile untar_path = ""out_dir = ""def useage(): print("useage: untar -i <path> -o <out dir> ") return def parse_usage(argv): try: opts, args = getopt.getopt(argv,"hi:o:", ["help",...

2022-10-10
洗牌算法
洗牌算法洗牌算法是将原来的数组进行打散,使原数组的某个数在打散后的数组中的每个位置上等概率的出现 12345678910111213141516171819202122#!/usr/bin/python3# -*- coding: utf-8 -*-import randomdef shuffle(arr): l = len(arr) for i in range(0, l): # 从剩下的数中随机选择一个数与arr[i]交换 # 每个数被选中的概率为1/(l-i) x = random.randint(i, l-1) # 交换arr[i]和arr[x] t = arr[x] arr[x]=arr[i] arr[i]=t print("{}:{}".format(i, arr)) return arrif __name__ == "__main__": '&...

2022-10-18
python使用argparse解析命令行参数
python使用argparse解析命令行参数python例子123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960#!/usr/bin/python3# -*- coding: utf-8 -*-import sysimport argparseimport osimport tarfile untar_path = ""out_dir = ""def parse_usage(): parser = argparse.ArgumentParser() parser.add_argument('-o', '--outdir', dest='out dir') parser.add_argument('-i', '--inpath', dest='t...

2022-10-19
使Aldous-Broder算法生成多层迷宫
多层迷宫生成Aldous-Broder algorithmThe Aldous-Broder algorithm also produces uniform spanning trees. 1.Pick a random cell as the current cell and mark it as visited.2.While there are unvisited cells: 1.Pick a random neighbour. 2.If the chosen neighbour has not been visited: 1.Remove the wall between the current cell and the chosen neighbour. 2.Mark the chosen neighbour as visited. 3.Make the chosen neighbour the current cell. Aldous-Broder算法Aldous-Broder算法也生成统一的生成树。 1。选择一个随机的单元格作为当...
公告
每天都有一个好心情

