Questions tagged [python-2to3]

2to3 is a tool for automated Python 2 to 3 code translation. Don't use this tag to ask about differences between Python 2 and Python 3. Use the [python-3.x] and [python-2.7] tags for that.

2to3 is a Python program that reads Python 2.x source code and applies a series of fixers to transform it into valid Python 3.x code. The standard library contains a rich set of fixers that will handle almost all code. 2to3 supporting library lib2to3 is, however, a flexible and generic library, so it is possible to write your own fixers for 2to3. lib2to3 could also be adapted to custom applications in which Python code needs to be edited automatically.

For more information, see the documentation at: http://docs.python.org/library/2to3.html

185 questions
-1
votes
1 answer

If scripts are only available on github with Python2.7, should they also release these in Python3.x alongside this? Replace the 2.7 code?

There is a substantial amount of scripts/code used for academic research written in python2.7 only available on a collaborator's github repos. The problem is this should be ported to python3.x someday. Currently, is the correct standard for users to…
ShanZhengYang
  • 16,511
  • 49
  • 132
  • 234
-1
votes
1 answer

Converting a [x][y] float back into a integer after converting Python 2.7 to 3.4

How do you convert a [x][y] float back into a integer after converting Python 2.7 to 3.4 .that is formatted as a float ex. self.table[x][y] into a integer to get the x and y values. Error I get return self.table[x][y].physics_module TypeError: list…
john taylor
  • 1,080
  • 15
  • 31
-2
votes
2 answers

this thing i'm doing wants python 2to3. i already have that. what do i do?

I'm trying to install the package pyminifier at the command prompt, this happens: C:\Users\[my name]\Downloads\JKLMBombpartyHelper-master\JKLMBombpartyHelper-master>python -m pip install pyminifier Collecting pyminifier Using cached…
envi
  • 13
  • 5
-3
votes
1 answer

python3 TypeError: a bytes-like object is required, not 'str' html

The code below works perfectly in python2.7 for thepkg in mypkgs.get('package'): pkgname = thepkg.get('name').encode('utf-8').replace(' ', '_') print(' ') but in…
Anoop P Alias
  • 373
  • 1
  • 6
  • 15
-3
votes
1 answer

What's a good automated way to change Python 2 code to code that is compatible with Python 2 and 3?

I'm changing some Python 2 code to be compatible with Python 2 and Python 3. The translation tool 2to3 works well at converting Python 2 code to Python 3 code that is not necessarily compatible with Python 2 code. An example is how it converts…
BlandCorporation
  • 1,324
  • 1
  • 15
  • 33
1 2 3
12
13