(May-16-2018, 06:48 AM)PrateekG Wrote:In that line you are splitting all the multiple lines answers in single line entries of your table.conv = open('chats.txt','r').readlines()
You need to fix a convention for your chat.txt file so you can recognise multiple lines responses.
The easiest thing is to use some well known format (json, yaml, .ini files...) but if you want to create your own, here is an example of a code that will concatenate lines that start with a space to the previous line:
with open('chats.txt','rt') as fd: conv = [] last = '' for line in fd: # Remove newline and whitespaces only from the end of the line line = line.rstrip() if line.startswith(' '): last += line else: if last: conv.append(last) last = line # Add the final string... last will be '' ony if the file is empty if last: conv.append(last)As format is not great (using spaces to specify the indent... where I have seen that
![Rolleyes Rolleyes](https://python-forum.io/images/smilies/rolleyes.png)