-2

I have a list in python in which I need to separate a value to multiple values using comma.

Below is my sample input list:

print(lt) #lt is a list

['New film released yesterday\nMovie will be released tomorrow\n
People will watch in theatres\n Movie is very bad\nIt can be good \n\n 
But the director flopped it\n Movie is good']

I have a single value in the above list. I need to insert comma(,) inside it to separate them to multiple values if I find Movie in the list.

Expected output:

 ['New film released yesterday\n','Movie will be released tomorrow\n
    People will watch in theatres\n','Movie is very bad\nIt can be good \n\n 
    But the director flopped it\n ','Movie is good']

Here you can see the the list having single value has been split to multiple values using comma (,). Please explain how to solve this issue.Thanks a lot!

keerthi007
  • 223
  • 1
  • 13

1 Answers1

0
lt=lt[0].replace('Movie', ',Movie').split(',')

This gives the right output.

['New film released yesterday\n','Movie will be released tomorrow\n
    People will watch in theatres\n','Movie is very bad\nIt can be good \n\n 
    But the director flopped it\n ','Movie is good']
keerthi007
  • 223
  • 1
  • 13