473,320 Members | 1,977 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Can Someone Help me Solve this

I have been learning python for a few days now and needed something to put my mind into, I was searching for a way to create a map using turtle and came across this code on my computer I created a file.txt with the following coordinates:

river, 5
-400, 400
-333, 400
300, 500

sand, 5
555, -200
600, 554
334, 432
4332, 43

Expand|Select|Wrap|Line Numbers
  1. import csv
  2. block=[]
  3. f=open("file.txt", "r")
  4. csv_reader=csv.reader(f)
  5. for row in csv_reader:
  6.    block.append(tuple(row))
This function does not work can someone help me conquer this
Apr 20 '14 #1
2 2403
stdq
94 64KB
What are you trying to accomplish with variable block?
Apr 30 '14 #2
dwblas
626 Expert 512MB
I don't know what
This function does not work
means. It prints fine for me.
Expand|Select|Wrap|Line Numbers
  1. test_data="""river, 5
  2. -400, 400
  3. -333, 400
  4. 300, 500
  5.  
  6. sand, 5
  7. 555, -200
  8. 600, 554
  9. 334, 432
  10. 4332, 43"""
  11. with open("./test.txt", "w") as fp_out:
  12.     fp_out.write(test_data)
  13.  
  14. import csv
  15. block=[]
  16. f=open("./test.txt", "r")
  17. csv_reader=csv.reader(f)
  18. print "\nInput file is"
  19. for row in csv_reader:
  20.     print row
  21. f.close() 
May 1 '14 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Andre | last post by:
Hi, In 'test.htm', there are two Select, one visible, the other invisible. The second becomes visible only if the number of records in a Access table <2. There is also a button to start the...
3
by: Alex | last post by:
Hi, I have a problem involving some design issue. I have two unrelated (that is, they do not derive from the same base) classes: ClassA ClassB Both have a quite similar interface, so they can...
2
by: Jet Leung | last post by:
When I debug my program and it return me an error call " have not handle ¡°System.StackOverflowException¡± appear in system.windows.forms.dll " How can I solve this problem??
7
by: Shapper | last post by:
Hello, I have an ASP:ImageButton where I want to call a function and pass a string: OnClick="Change_Photo("John")" I am having problems with "". I tried
7
by: Mat | last post by:
I am developping multi-user windows application. i use Access database. user edit, add and delete data from database. Request: when an item is deleted ,added or modified by an user, all others...
7
by: Nobody | last post by:
Anyone have a clean way of solving this define issue? In Windows, there are sometimes unicode functions and multibyte functions... the naming convention used is FunctionA for multibyte and...
0
jautrus
by: jautrus | last post by:
I would like to have div tag over list box, not list box over div tag. I have this problem on many pages usually when I use drop down menus. I try to solve this problem with z-index but it doesn't...
2
by: itsvineeth209 | last post by:
My task is to create login control without using login control in tools. I shouldnt use sqldatasource or any other. I should use only data sets, data adapters and data readers etc. U had created...
7
by: akmaRudiliyn | last post by:
Hai everybody :). I have problem and need help. ERROR: ERROR Violation of PRIMARY KEY constraint 'PK_Table1_01'. Cannot insert duplicate key in object 'dbo.table1'. ERROR The statement has...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.