473,387 Members | 1,517 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,387 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 2405
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

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.