Python Forum
misunderstanding of format in print function
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
misunderstanding of format in print function
#3
*client_address unpacks the tuple into its individual elements. This way format(*client_address,client_address[1],message['FrameNumber']) is same as format('192.168.167.200', 49706, 49706, 396)
You have just 3 placeholders thus the last element (396) is simply ignored

when on 2 lines it just ignores the second 49706.

In other words, change your code to .format(*client_address, message['FrameNumber'])
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: misunderstanding of format in print function - by buran - Oct-29-2019, 12:44 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  print doesnt work in a function ony 2 471 Mar-11-2024, 12:42 PM
Last Post: Pedroski55
  How to print variables in function? samuelbachorik 3 1,052 Dec-31-2022, 11:12 PM
Last Post: stevendaprano
  How to print the output of a defined function bshoushtarian 4 1,453 Sep-08-2022, 01:44 PM
Last Post: deanhystad
  .format function Menthix 6 1,834 Mar-12-2022, 10:32 AM
Last Post: stevendaprano
  use of format function barryjo 3 1,801 Feb-01-2022, 08:07 AM
Last Post: menator01
  Why does absence of print command outputs quotes in function? Mark17 2 1,515 Jan-04-2022, 07:08 PM
Last Post: ndc85430
  return vs. print in nested function example Mark17 4 1,916 Jan-04-2022, 06:02 PM
Last Post: jefsummers
  Date format and past date check function Turtle 5 4,694 Oct-22-2021, 09:45 PM
Last Post: deanhystad
  Print first day of the week as string in date format MyerzzD 2 2,143 Sep-29-2021, 06:43 AM
Last Post: MyerzzD
  output correction using print() function afefDXCTN 3 11,438 Sep-18-2021, 06:57 PM
Last Post: Sky_Mx

Forum Jump:

User Panel Messages

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