Answered step by step
Verified Expert Solution
Question
1 Approved Answer
this code works perfect for one single paragraph. But what if we have 1000 paragraphs in one txt file. The code doe snot work: import
this code works perfect for one single paragraph. But what if we have 1000 paragraphs in one txt file. The code doe snot work:
import csv data = "1. KOSTIOUK, Evgueni, Alzey, Germany; Poland; DOB 13 Jun 1954; nationality Belarus; Gender Male (individual) [RUSSIA-EO14024]. Designated pursuant to sections 1(a)(i) of Executive Order 14024 of April 15, 2021, 'Blocking Property With Respect To Specified Harmful Foreign Activities of the Government of the Russian Federation,' 86 FR 20249, 3 CFR, 2021 Comp., p. 542 (Apr. 15, 2021) (E.O. 14024) for operating or having operated in the technology sector of the Russian Federation economy. 2. GAZPROM VNIIGAZ, OOO (Cyrillic: ) (a.k.a. GAZPROM VNIIGAZ; a.k.a. LLC VNIIGAZ; a.k.a. OBSHCHESTVO S OGRANICHENNOI OTVETSTVENNOSTYU 'NAUCHNO-ISSLEDOVATELSKI INSTITUT PRIRODNYKH GAZOV I GAZOVYKH TEKHNOLOGI - GAZPROM VNIIGAZ' (Cyrillic: - - ); f.k.a. "ALL UNION SCIENTIFIC RESEARCH INSTITUTE OF NATURAL GASES AND GAS TECHNOLOGIES"; a.k.a. "LIMITED LIABILITY COMPANY SCIENTIFIC RESEARCH INSTITUTE OF NATURAL GASES AND GAS TECHNOLOGIES"; a.k.a. "VNIGAZ"), 15 Gazovikov St., bld. 1, Razvilka, Leninski Raion, Moskovskaya obl. 142717, Russia; Sevastopolskaya St. 1A, Ukhta, Komi Republic, Russia; Website www.vniigaz.ru; Email Address a..m@vniigaz.gazprom.ru; Executive Order 13662 Directive Determination - Subject to Directive 4; Secondary sanctions risk: Ukraine-/Russia-Related Sanctions Regulations, 31 CFR 589.201 and/or 589.209; Organization Established Date 30 Jun 1999; Registration ID 1025000651598; Tax ID No. 5003028155. 3. KOSTIOUK4, Evgueni, Alzey, Germany; Poland; DOB 13 Jun 1954; nationality Belarus; Gender Male (individual) [RUSSIA-EO14024]. Designated pursuant to sections 1(a)(i) of Executive Order 14024 of April 15, 2021, 'Blocking Property With Respect To Specified Harmful Foreign Activities of the Government of the Russian Federation,' 86 FR 20249, 3 CFR, 2021 Comp., p. 542 (Apr. 15, 2021) (E.O. 14024) for operating or having operated in the technology sector of the Russian Federation economy. 4. NAUCHNO-PROIZVODSTVENNOE PREDPRIYATIE GURAMI ELEKTRONIKS (a.k.a. NPP GURAMI ELEKTRONIKS), ul. Profsoyuznaya d. 37A, floor/office 4/412, Naro-Fominsk 143306, Russia; Tax ID No. 5030098049 (Russia); Registration Number 1205000027770 (Russia) [RUSSIA-EO14024]. Designated pursuant to section 1(a)(i) of Executive Order 14024 for operating or having operated in the electronics sector of the Russian Federation economy." id_name = data.split(",")[0] id_parts = id_name.split(". ") id = id_parts[0] name = id_parts[1] description = ",".join(data.split(",")[1:]).strip() output = [[id, name, description]] with open('output.csv', mode='w', newline='') as file: writer = csv.writer(file) writer.writerow(['ID', 'NAME', 'DESCRIPTION']) writer.writerows(output) print(f"ID={id}, NAME={name}, DESCRIPTION={description}")
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started