Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
A simple csv code
#1
import csv
csvFile = open("c:\Python36\files\test.csv", 'w+')
try:
	writer = csv.writer(csvFile)
	writer.writerow(('number', 'number plus 2', 'number times 2'))
	for i in range(10):
		writer.writerow(i, i+2, i*2)
finally:
	csvFile.close()
Error:
Traceback (most recent call last): File "C:\Python36\kodovi\csvv.py", line 9, in <module> csvFile = open("c:\Python36\files\test.csv", 'w+') OSError: [Errno 22] Invalid argument: 'c:\\Python36\x0ciles\test.csv'
What did I do wrong? Tried several combinations with several paths but it gave me similar error. I didn't create files directory, expecting that it will be created as per this code.
Reply


Messages In This Thread
A simple csv code - by Truman - Dec-21-2018, 09:37 PM
RE: A simple csv code - by nilamo - Dec-21-2018, 09:48 PM
RE: A simple csv code - by ichabod801 - Dec-21-2018, 09:49 PM
RE: A simple csv code - by buran - Dec-21-2018, 09:49 PM
RE: A simple csv code - by Truman - Dec-21-2018, 10:00 PM
RE: A simple csv code - by buran - Dec-21-2018, 10:10 PM
RE: A simple csv code - by woooee - Dec-21-2018, 10:11 PM
RE: A simple csv code - by Truman - Dec-21-2018, 10:17 PM
RE: A simple csv code - by Truman - Dec-21-2018, 11:19 PM
RE: A simple csv code - by gehrenfeld - Dec-22-2018, 01:16 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Help with simple code JacobSkinner 1 451 Mar-18-2024, 08:08 PM
Last Post: deanhystad
  I have a code which is very simple but still I cannot detect what's wrong with it max22 1 575 Nov-07-2023, 04:32 PM
Last Post: snippsat
  help me simple code result min and max number abrahimusmaximus 2 995 Nov-12-2022, 07:52 AM
Last Post: buran
  Simple encoding code ebolisa 3 1,548 Jun-18-2022, 10:59 AM
Last Post: deanhystad
  How would you (as an python expert) make this code more efficient/simple coder_sw99 3 1,881 Feb-21-2022, 10:52 AM
Last Post: Gribouillis
  Simple code question about lambda and tuples JasPyt 7 3,495 Oct-04-2021, 05:18 PM
Last Post: snippsat
  My simple code don't works !! Nabi666 1 1,659 Sep-06-2021, 12:10 PM
Last Post: jefsummers
Sad SyntaxError: from simple python example file from mind-monitor code (muse 2) warmcupoftea 4 2,959 Jul-16-2021, 02:51 PM
Last Post: warmcupoftea
  Plotting sum of data files using simple code Laplace12 3 3,180 Jun-16-2021, 02:06 PM
Last Post: BashBedlam
  Help with isinstance command (very simple code) Laplace12 2 2,083 Jul-30-2020, 05:26 AM
Last Post: Laplace12

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020