To process my data files I need whitespaces between all characters in a string, to be written to a text file. Is there a simple Pythonfunction to solve this?
Steko
0
Newbie Poster
Recommended Answers
Jump to PostHi!
Well, Python doesn't have one simple function for this, but you can combine 2 simple functions, list() and join() :)
s = "hello" # convert the string to a list of characters lst = list(s) # lst now looks like this: ['h', 'e', 'l', 'l', …
All 2 Replies
Reply to this topic
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.