简体   繁体   English

Python 2to3不更改文件

[英]Python 2to3 not changing files

I have a bunch of modules written in python 2.x and I need them to be in 3.x for them to work. 我有一堆用python 2.x编写的模块,我需要它们在3.x中才能工作。 I ran 2to3 on the entire folder, and it seemed to work fine, but when I looked at the files again they were the same. 我在整个文件夹上运行了2to3,它似乎工作正常,但当我再次查看文件时它们是相同的。 I have not used 2to3 and was wondering if it saves the converted files in some other directory. 我没有使用2to3,并想知道它是否将转换后的文件保存在其他目录中。

您需要使用-w开关明确告诉2to3实际写入更改:

2to3 -w example.py

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM