Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tab Delimited Strings?
#7
Thanks. I can see how putting the items into a tuple first would help in some cases, but i think it doesn't give much benefit here. Your f statement doesn't use the entire tuple t, it uses each element individually. So you're putting things into a tuple, and then taking them out again.

Your f statement is less to type than my join, which is good.

# join
myString = "\t".join((str(idx), choice, '\n'))

# f
myString = f"{str(idx)}\t{choice}\n"
Would the f statement execute faster on a large set? (i don't mean more elements, i mean more rows with these same 2 elements per row)

One thing i don't like is that i can't embed spaces in the f statement for visual clarity, because the spaces would become part of the string.
myString = f" {str(idx)} \t {choice} \n"
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,752 Aug-06-2023, 11:42 AM
Last Post: deanhystad
  Splitting strings in list of strings jesse68 3 2,568 Mar-02-2022, 05:15 PM
Last Post: DeaD_EyE
  dataframe write to tab delimited differs from Excel koh 0 2,574 Aug-01-2021, 02:46 AM
Last Post: koh
  Appending data into a file in tab delimited format metro17 1 5,336 Aug-06-2019, 07:34 AM
Last Post: fishhook
  Finding multiple strings between the two same strings Slither 1 3,245 Jun-05-2019, 09:02 PM
Last Post: Yoriz
  Delimited Values to ROW - Lucky Train ? karthi_python 1 2,881 May-30-2019, 06:40 AM
Last Post: karthi_python
  Creating a delimited file from DB Table anubhav2020 9 9,891 Sep-19-2018, 05:22 PM
Last Post: Axel_Erfurt
  Load Comma Delimited csv to Nested Dictionary Huck 2 9,311 Apr-30-2018, 04:21 PM
Last Post: Huck
  lists, strings, and byte strings Skaperen 2 4,980 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