[Solved] converting a text file to csv file with out index


Try this:

from io import StringIO

csvtext = StringIO("""1 1 1 1 1 
2
3 4 4 4 4""")

data = pd.read_csv(csvtext, sep='\n', header=None)

data.to_csv('out.csv', index=False, header=False)

#on windows

!type out.csv

Output:

1 1 1 1 1 
2
3 4 4 4 4

2

solved converting a text file to csv file with out index