简体   繁体   中英

Python 2.7, Excel.csv getting specific columns &…?

Sorry , guys If there is a post similar or exactly like this. I'm new to programming/coding and just couldn't find a similar post. What I'm trying to do is a script that takes a keyword/input from the user and from that keyword the program will find all columns in the excel.csv data. Then make a copy of the column/s to a new excel file . This is with the intention of working with large excel files. Is there any tutorials or a place where I can find even tips/hints/Examples of how to do this? Thanks for your time and comprehension.

Again is just:

  1. Name of the file to be read.
  2. keyword which identify columns to be saved/copy/cut.
  3. Create new file then paste + truncate?

    ( Anything close to this or a tutorials/examples would be truly appreciated. )

Sincerely, A novice.

Here you go..

>>> import csv
>>> with open('eggs.csv', 'rb') as csvfile:
...     spamreader = csv.reader(csvfile, delimiter=' ', quotechar='|')
...     for row in spamreader:
...         print ', '.join(row)
Spam, Spam, Spam, Spam, Spam, Baked Beans
Spam, Lovely Spam, Wonderful Spam

Hope this will give you some idea...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM