Python Forum
replace white space with a string, is this pythonic?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
replace white space with a string, is this pythonic?
#2
basically yes
>>> s = 'foo \t bar'.split()
>>> s
['foo', 'bar']
>>> '_'.join(s)
'foo_bar'
Recommended Tutorials:
Reply


Messages In This Thread
RE: replace white space with a string, is this pythonic? - by metulburr - Jun-18-2019, 11:36 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Question [Beautiful Soup] Replace tag.string from another file? Winfried 0 106 Yesterday, 02:39 AM
Last Post: Winfried
  White Screen Issue with Toolbar After Python Installation evelynfreya 2 1,079 Nov-25-2024, 06:26 PM
Last Post: deanhystad
Question [SOLVED] How to replace characters in a string? Winfried 2 1,070 Sep-04-2024, 01:41 PM
Last Post: Winfried
  identify not white pixels in bmp flash77 17 7,845 Nov-10-2023, 09:21 PM
Last Post: flash77
  Pythonic from a C++ perspective PyDan 2 1,438 Sep-18-2023, 11:39 AM
Last Post: PyDan
  Need to replace a string with a file (HTML file) tester_V 1 1,957 Aug-30-2023, 03:42 AM
Last Post: Larz60+
  Replace string in a nested Dictianory. SpongeB0B 2 2,427 Mar-24-2023, 05:09 PM
Last Post: SpongeB0B
  Replace with upper(string) WJSwan 7 2,840 Feb-10-2023, 10:28 AM
Last Post: WJSwan
  Removing Space between variable and string in Python coder_sw99 6 10,733 Aug-23-2022, 01:15 PM
Last Post: louries
  Remove a space between a string and variable in print sie 5 2,929 Jul-27-2022, 02:36 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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