Sitemap
Tech Talk With Alex

Tech Talk With Alex

At the end of the day, nothing is too hard to understand when it is explained simply. Making complex concepts easy for everyone to get smart!

4 Ways to export Data from Python

Text File

with open('data.txt', 'w') as file:
for item in data:
file.write(str(item) + '\n')

CSV File

Get Tech Talk With Alex’s stories in your inbox

Join Medium for free to get updates from this writer.

import csv

xtiwith open('data.csv', 'w', newline='') as file:
writer = csv.writer(file)
writer.writerows(data)

Excel File

import pandas as pd

df = pd.DataFrame(data)
df.to_excel('data.xlsx', index=False)

JSON

import json

with open('data.json', 'w') as file:
json.dump(data, file)

--

--

Tech Talk With Alex
Tech Talk With Alex

Written by Tech Talk With Alex

At the end of the day, nothing is too hard to understand when it is explained simply. Making complex concepts easy for everyone to get smart!