3 Replies - 599 Views - Last Post: 14 September 2014 - 09:50 AM Rate Topic: -----

#1 DblAAssassin   User is offline

  • D.I.C Regular

Reputation: 43
  • View blog
  • Posts: 322
  • Joined: 11-May 13

Variable Printing Python 3.4

Posted 14 September 2014 - 08:42 AM

Had some free time so decided to translate some old Python 2.7 programs to 3.4, got stuck on this one survey program, it is a very simple program, just need to know how to print data the user has entered.

Looks like this in 2.7
print 'You entered: ' , x , '.'



How would I go about doing this in 3.4. Couldn't find it on the Documentation, a link to that would be sufficient. Thanks for the help!
Is This A Good Question/Topic? 0
  • +

Replies To: Variable Printing Python 3.4

#2 jon.kiparsky   User is offline

  • Beginner
  • member icon


Reputation: 12350
  • View blog
  • Posts: 20,984
  • Joined: 19-March 11

Re: Variable Printing Python 3.4

Posted 14 September 2014 - 08:44 AM

print 'You entered: ' , x , '.'




This should work for you:
print('You entered %s.'% x)

Was This Post Helpful? 1
  • +
  • -

#3 andrewsw   User is offline

  • no more Mr Potato Head
  • member icon

Reputation: 6957
  • View blog
  • Posts: 28,696
  • Joined: 12-December 12

Re: Variable Printing Python 3.4

Posted 14 September 2014 - 08:50 AM

What’s New In Python 3.0

I am not sure what article you are reading to help you convert, but the print() function will definitely appear very near the top of this list. If you search there are even a number of conversion tools.
Was This Post Helpful? 1
  • +
  • -

#4 DblAAssassin   User is offline

  • D.I.C Regular

Reputation: 43
  • View blog
  • Posts: 322
  • Joined: 11-May 13

Re: Variable Printing Python 3.4

Posted 14 September 2014 - 09:50 AM

View Postjon.kiparsky, on 14 September 2014 - 09:44 AM, said:

print 'You entered: ' , x , '.'




This should work for you:
print('You entered %s.'% x)


Thanks!

View Postandrewsw, on 14 September 2014 - 09:50 AM, said:

What’s New In Python 3.0

I am not sure what article you are reading to help you convert, but the print() function will definitely appear very near the top of this list. If you search there are even a number of conversion tools.

This is actually the article I was looking at. Must of missed anyways, thanks!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1