Prompting user to enter column names from a csv file (not using pandas framework)

后端 未结 2 621
青春惊慌失措
青春惊慌失措 2021-01-26 18:13

I am trying to get the column names from a csv file with nearly 4000 rows. There are about 14 columns.

I am trying to get each column and store it into a list and then p

2条回答
  •  囚心锁ツ
    2021-01-26 18:59

    You can very well use the Python input to get the input from user, if you want to prompt no. of times, use the for loop to get inputs. Check Below code:

    def get_user_val(no_of_entries = 5):
        print('Enter {} inputs'.format(str(no_of_entries)))
        val_list = []
        for i in range(no_of_entries):
                val_list.append(input('Enter Input {}:'.format(str(i+1))))
        return val_list
    
    get_user_val()
    

提交回复
热议问题