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
#2
new style
return "{} {}\n{}".format(self.salutation,self.name,self.address)
f-string
return f"{self.salutation} {self.name}\n{self.address}")
use f-strings
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs

Reply


Messages In This Thread
RE: Changing to new Python formatting example - by buran - Sep-21-2020, 06:50 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Virtual Env changing mysql connection string in python Fredesetes 0 400 Dec-20-2023, 04:06 PM
Last Post: Fredesetes
  python-docx: preserve formatting when printing lines Tmagpy 4 2,142 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,655 Jul-05-2022, 11:29 PM
Last Post: deanhystad
  changing Python files to .exe alok 2 2,256 Jul-20-2021, 02:49 PM
Last Post: alok
  Changing Index of 2 List in python giddyhead 0 1,696 Mar-05-2021, 05:45 PM
Last Post: giddyhead
  Automating to run python script 100 times by changing parameters pmt 1 2,626 Dec-29-2020, 10:31 AM
Last Post: andydoc
  changing animation speed using buttons in python microwave 1 2,141 Jun-24-2020, 05:21 PM
Last Post: GOTO10
  Problem after changing Python directory Souila7 1 2,172 Jan-25-2020, 05:06 PM
Last Post: ThiefOfTime
  changing the process command line arguments in python Skaperen 3 3,037 Aug-19-2019, 02:40 PM
Last Post: wavic
  Changing Python Versions in Ubuntu 16.04 ErnestTBass 2 3,164 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