Python Forum
Changing to new Python formatting example
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Changing to new Python formatting example
#1
1) Is the following changes to new style of Python Formatting correct? And if not, what is a better way to efficiently format by reduce no. of lines, etc.

2) For example, there is the f-string method. When is the best scenario to use each formatting method?

OLD STYLE
return "%s %s\n%s"%(self.salutation,self.name,self.address)
NEW STYLE
return "{} {}\n{}"%(self.salutation,self.name,self.address)
Reply


Messages In This Thread
Changing to new Python formatting example - by leodavinci1990 - Sep-21-2020, 06:48 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Virtual Env changing mysql connection string in python Fredesetes 0 383 Dec-20-2023, 04:06 PM
Last Post: Fredesetes
  python-docx: preserve formatting when printing lines Tmagpy 4 2,112 Jul-09-2022, 01:15 AM
Last Post: Tmagpy
  Changing a string value to a numerical value using python code and a lamda function Led_Zeppelin 6 1,627 Jul-05-2022, 11:29 PM
Last Post: deanhystad
  changing Python files to .exe alok 2 2,248 Jul-20-2021, 02:49 PM
Last Post: alok
  Changing Index of 2 List in python giddyhead 0 1,684 Mar-05-2021, 05:45 PM
Last Post: giddyhead
  Automating to run python script 100 times by changing parameters pmt 1 2,615 Dec-29-2020, 10:31 AM
Last Post: andydoc
  changing animation speed using buttons in python microwave 1 2,124 Jun-24-2020, 05:21 PM
Last Post: GOTO10
  Problem after changing Python directory Souila7 1 2,165 Jan-25-2020, 05:06 PM
Last Post: ThiefOfTime
  changing the process command line arguments in python Skaperen 3 3,025 Aug-19-2019, 02:40 PM
Last Post: wavic
  Changing Python Versions in Ubuntu 16.04 ErnestTBass 2 3,143 Jan-10-2019, 05:45 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

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