Python Forum
2to3 fails on very simple script
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
2to3 fails on very simple script
#21
it's a simple answer. too simple. too simple for 2to3 to do it?
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#22
(Oct-20-2016, 02:04 AM)Skaperen Wrote: it's a simple answer. too simple. too simple for 2to3 to do it?
Is there really a problem here at all Think
python 2.x
#greet.py
def greet(name):
    return("Hello, {}!".format(name))

name = raw_input("What's your name? ")
print 'Hello {}'.format(greet(name))
print('Hello {}'.format(greet(name)))
I run python 2to3.py -w greet.py
#greet.py
def greet(name):
    return("Hello, {}!".format(name))

name = input("What's your name? ")
print('Hello {}'.format(greet(name)))
print('Hello {}'.format(greet(name)))
It only convert the python 2.x print statement to python 3.x print function,
and do not touch python 3.x print function.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Simple Python script, path not defined dubinaone 3 4,017 Nov-06-2021, 07:36 PM
Last Post: snippsat
  Need help creating a simple script Nonameface 12 7,124 Jul-14-2020, 02:10 PM
Last Post: BitPythoner
  Python 3.6.10 fails when running a localized script. Mikee 2 3,043 Jul-09-2020, 10:25 PM
Last Post: Mikee
  Simple text to binary python script gmills13 2 4,413 Feb-04-2020, 08:44 PM
Last Post: snippsat
  python script fails with a lot of data bluethundr 2 2,973 Nov-11-2019, 01:35 PM
Last Post: bluethundr
  Made a simple script for android (really simple) but it is not running anddontyoucomebacknomore 2 3,333 Mar-06-2019, 12:19 AM
Last Post: anddontyoucomebacknomore
  How to use 2to3.py converter under Windows OS samsonite 2 8,923 Mar-02-2019, 05:49 AM
Last Post: samsonite
  Confusing output from 2to3 about what files need change Moonwatcher 1 5,877 Dec-30-2018, 04:07 PM
Last Post: Gribouillis
  Error during 2to3 conversion krow4869 3 5,325 Oct-14-2018, 08:19 AM
Last Post: Larz60+
  Simple script that seems to misbehave? Nwb 1 3,060 Jun-10-2018, 05:30 AM
Last Post: Nwb

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020