簡體   English   中英

Python如何撥打2to3?

[英]How to call 2to3 in Python?

有沒有一種方法可以通過在 python 中調用2to3將 python2 字符串轉換為 python3 字符串,而無需通過命令行調用它?

input = 'a=raw_input()'
output = 'a=input()'

2to3是開源的:

https://github.com/python/cpython/tree/3.10/Lib/lib2to3/

refactor_string function 就是您要查找的內容。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM