jasleenkapoor / Python-Project-

MIT License
0 stars 0 forks source link

Extra report information (references) #12

Open zhap066 opened 1 year ago

zhap066 commented 1 year ago

Collect together used sites in order to support code, create a reference page.

ZHAP054 commented 1 year ago

code i stole:

def write_a_csv(timeseries, filename): Open the file for writing (w+) with open(filename, "w+") as file: Add a header to the file so people know what each column is print(f"#time[s],voltage[V]", file=file)

     Loop over the rows and print them to the file
    for t, d in zip(timeseries.times, timeseries.data):
        print(f"{t},{d}", file=file)

write_a_csv(timeseries, "use_print_to_write_a_csv_example.csv") import csv

field names fields = ['Name', 'Branch', 'Year', 'CGPA']

data rows of csv file rows = [ ['Nikhil', 'COE', '2', '9.0'], ['Sanchit', 'COE', '2', '9.1'], ['Aditya', 'IT', '2', '9.3'], ['Sagar', 'SE', '1', '9.5'], ['Prateek', 'MCE', '3', '7.8'], ['Sahil', 'EP', '2', '9.1']]

name of csv file filename = "university_records.csv"

writing to csv file with open(filename, 'w') as csvfile: creating a csv writer object csvwriter = csv.writer(csvfile)

 writing the fields 
csvwriter.writerow(fields) 

 writing the data rows 
csvwriter.writerows(rows)
ZHAP054 commented 1 year ago

https://stackoverflow.com/questions/57702836/how-can-i-write-my-data-which-contains-floats-to-a-txt-file-in-python

zhap066 commented 1 year ago

https://packaging.python.org/en/latest/tutorials/packaging-projects/

11/11/2022 16:33