Home > Blockchain >  Need a push to start with a function about text files, I can't figure this out on my own
Need a push to start with a function about text files, I can't figure this out on my own

Time:12-09

I don't need the entire code but I want a push to help me on the way, I've been searching on the internet for clues on how to start to write a function like this but I haven't gotten any further then just the name of the function.

I want help on the first of the 2 functions (citizens) Example of how citizens should work

So I haven't got the slightest clue on how to start with this, I don't know how to work with text files. Any tips?

CodePudding user response:

These text files are CSV (Comma Separated Values). It is a simple file format used to store tabular data.

You may explore Python's inbuilt module called csv.

Following code snippet an example to load .csv file in Python:

import csv
filename = 'us_population.csv'
with open(filename, 'r') as csvfile:
    csvreader = csv.reader(csvfile)
  • Related