Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tab Delimited Strings?
#5
(Jan-13-2024, 09:30 PM)sgrey Wrote: what is your actual use case? Do you need to print out elements of lists/tuples of arbitrary length or do you always have only 2 elements?
Always 2 elements followed by newline.

Quote:Depending on what you are writing, you can just use format string like print(f"{idx[0]}\t{idx[1]}\n")
I'm just trying to assemble the string here, not print it. How to do that with f?
My terms are just str(idx) and choice, with a trailing newline.

Quote:you can define your own __str__ method in a data class.
I'd like to learn how, but sounds even more complicated.
Reply


Messages In This Thread
Tab Delimited Strings? - by johnywhy - Jan-13-2024, 08:54 PM
RE: Tab Delimited Strings? - by deanhystad - Jan-13-2024, 09:05 PM
RE: Tab Delimited Strings? - by johnywhy - Jan-13-2024, 09:11 PM
RE: Tab Delimited Strings? - by sgrey - Jan-13-2024, 09:30 PM
RE: Tab Delimited Strings? - by johnywhy - Jan-13-2024, 09:40 PM
RE: Tab Delimited Strings? - by sgrey - Jan-13-2024, 09:48 PM
RE: Tab Delimited Strings? - by johnywhy - Jan-13-2024, 10:11 PM
RE: Tab Delimited Strings? - by sgrey - Jan-13-2024, 10:34 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Trying to understand strings and lists of strings Konstantin23 2 1,734 Aug-06-2023, 11:42 AM
Last Post: deanhystad
  Splitting strings in list of strings jesse68 3 2,550 Mar-02-2022, 05:15 PM
Last Post: DeaD_EyE
  dataframe write to tab delimited differs from Excel koh 0 2,560 Aug-01-2021, 02:46 AM
Last Post: koh
  Appending data into a file in tab delimited format metro17 1 5,318 Aug-06-2019, 07:34 AM
Last Post: fishhook
  Finding multiple strings between the two same strings Slither 1 3,235 Jun-05-2019, 09:02 PM
Last Post: Yoriz
  Delimited Values to ROW - Lucky Train ? karthi_python 1 2,868 May-30-2019, 06:40 AM
Last Post: karthi_python
  Creating a delimited file from DB Table anubhav2020 9 9,801 Sep-19-2018, 05:22 PM
Last Post: Axel_Erfurt
  Load Comma Delimited csv to Nested Dictionary Huck 2 9,274 Apr-30-2018, 04:21 PM
Last Post: Huck
  lists, strings, and byte strings Skaperen 2 4,971 Mar-02-2018, 02:12 AM
Last Post: Skaperen

Forum Jump:

User Panel Messages

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