473,549 Members | 3,127 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Can Someone Help me Solve this

1 New Member
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 2411
stdq
94 New Member
What are you trying to accomplish with variable block?
Apr 30 '14 #2
dwblas
626 Recognized Expert Contributor
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
1128
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 VB-procedure. I choose first a value into the first Select (sel1), then i click on the button to start VB-procedure. If the value="a", then get the...
3
1841
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 be use interchangeably, that is: ptr = new ClassA;
2
1964
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
1997
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
1653
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 user in the network which has application running should automatically see the change. in case of remove action, the item should disappear from the...
7
2150
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 FunctionW for unicode... So basically what happens is: void FunctionA(); void FunctionW();
0
1359
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 work. Have anybody some idea? Problem only with IE .... like always :/ Here is the simple example: <html>
2
2368
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 table login with fields username(varchar(50)), password(varchar(50)), firstname(varchar(50)), lastname(varchar(50)). U had to display username , first...
7
89967
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 been terminated. MY QUESTION:
0
7446
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7718
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7809
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6041
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5088
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3480
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1936
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1058
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.