从字符串收集中,我需要提取特定的字符串并将其写入CSV文件,特别是列中

时间:2019-07-18 01:43:42

标签: python python-3.x csv csv-write-stream

I would like to extract a specific string from a collections of string and write that specific string value into CSV file columns. Also the append operation. At the same time if duplicate column name found, we need to write it only once into the column.

From below example, i would like to extract keywords surrounded by ${} and write it into the CSV column. At the same there repeats of ${one} exists, in this scenario i need to check for duplicates and write it only once, if already exists then eliminate that keyword / string and move on to the next.

Example:
/function/${one}
/functions/one/${two}
/functions/${one}/${three}

谢谢!

By referring the example from problem statement, the output expected as below,

Column 1 in CSV file should hold - one
Column 2 in CSV file should hold - two
Column 3 in CSV file should hols - three

注意:在将字符串值写入CSV列时,我也想检查重复项。

0 个答案:

没有答案