Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Split String
#7
(Mar-19-2019, 06:41 AM)lekuru01 Wrote:
(Mar-19-2019, 02:19 AM)Larz60+ Wrote: several ways to do this, a few below
g = g + 'more text'
if python 3.6 or newer:
g = f'{g} more text'

Again, thank you for your response, but I am not sure If I understand you response. I am just trying to understand how to make multiple strings work. Thank you

g="Hello world ! what is your name ? my name is Daniel . I am fine "
g1=g.split(' ')
print(g1[0:3],end="")
print(',',end="")
print(g1[3:}
Reposting to adhere to the rule of the house

(Mar-18-2019, 11:44 PM)lekuru01 Wrote:
(Mar-16-2019, 07:58 AM)Larz60+ Wrote: need closing quote on line 1
first split on '!'
which will give you a list with two cells
split each cell on space g1 = g[0].split() same for g[1]
append '!' to g[0]
print(g0, g1)
Thank you for your response. One other question , how do you manipulate the spring to add addition strings to the original string. Thanks

(Mar-17-2019, 08:52 AM)saravanatn Wrote:
g="Hello world ! what is your name ?"
g1=g.split(' ')
print(g1[0:3],end="")
print(',',end="")
print(g1[3:])

Thank you for your response, one additional question, what is I want to add more to the string, like this

g="Hello world ! what is you name ? my name is Daniel . I am fine

Thank you for your response, one additional question, what is I want to add more to the string, like this

g="Hello world ! what is you name ? my name is Daniel . I am fine 
g="Hello world ! what is your name ?"
g1=g.split(' ')
print(g1[0:3],end="")
print(',',end="")
print(g1[3:])
Reply


Messages In This Thread
Split String - by lekuru01 - Mar-16-2019, 03:07 AM
RE: Split String - by Larz60+ - Mar-16-2019, 07:58 AM
RE: Split String - by lekuru01 - Mar-18-2019, 11:44 PM
RE: Split String - by saravanatn - Mar-17-2019, 08:52 AM
RE: Split String - by Larz60+ - Mar-19-2019, 02:19 AM
RE: Split String - by lekuru01 - Mar-19-2019, 06:41 AM
RE: Split String - by lekuru01 - Mar-19-2019, 10:42 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Split string into 160-character chunks while adding text to each part iambobbiekings 9 9,606 Jan-27-2021, 08:15 AM
Last Post: iambobbiekings
  [split] Splitting a string into six pieces susmis666 1 2,215 Dec-25-2018, 06:16 PM
Last Post: ichabod801
  How to access each line in for loop and split string SriRajesh 2 3,144 Aug-14-2017, 06:05 PM
Last Post: tetrmnot

Forum Jump:

User Panel Messages

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