Jump to content

writer.writerow not defined?! Python 3.5

Hey,

 

So my code worked completely first try! Then I changed a search keyword and now it is giving me this error

 

NameError                                 Traceback (most recent call last)
<ipython-input-4-e9d9683074c1> in <module>()
     42 
     43 for word, count in c.most_common():
---> 44     writer.writerow ([word,count])
     45 #    print(word,count)
     46 

NameError: name 'writer' is not defined

 

What would cause this error? I have already imported csv and the only thing I changed was the search word....I also tried undo-ing the changes, and it gives me the same error...

 

Thoughts? Should I quit the kernal and try again?

CPU: Intel Core i7 8700k CPU Cooler: Corsair Hydro Series H100i Mobo:  Memory: G.Skill Ripjaws X 32GB 2133 Storage #1: 1TB 850 EVO SSD Storage #2: Western Digital Black 2TB Storage #3: Western Digital Green 4TB GPU: Gigabyte 980 Ti G1 Case: Mastercase5 PSU: EVGA 750 W G2 80+Gold Keyboard: Corsair K70 RGB Cherry MX Brown Mouse: Razer Deathadder Elite Monitor: LG 34UM94 Headset: Bose

Phone: Samsung Galaxy S9

Link to comment
https://linustechtips.com/topic/547252-writerwriterow-not-defined-python-35/
Share on other sites

Link to post
Share on other sites

I figured this out.

 

I forgot the cvs = writer etc command..

 

identification:10 T error.

ID10T

CPU: Intel Core i7 8700k CPU Cooler: Corsair Hydro Series H100i Mobo:  Memory: G.Skill Ripjaws X 32GB 2133 Storage #1: 1TB 850 EVO SSD Storage #2: Western Digital Black 2TB Storage #3: Western Digital Green 4TB GPU: Gigabyte 980 Ti G1 Case: Mastercase5 PSU: EVGA 750 W G2 80+Gold Keyboard: Corsair K70 RGB Cherry MX Brown Mouse: Razer Deathadder Elite Monitor: LG 34UM94 Headset: Bose

Phone: Samsung Galaxy S9

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×