Re: parse a csv file into a text file

2014-02-05 Thread Zhen Zhang
On Wednesday, February 5, 2014 7:33:00 PM UTC-5, Roy Smith wrote: > In article <5c268845-003f-4e24-b27a-c89e9fbfc...@googlegroups.com>, > > Zhen Zhang wrote: > > > > > [code] > > > > > > import csv > > > file = open('raw.csv') > > > reader = csv.reader(file) > > > > > > f = open('Nice

Re: [Solved]Re: Help with TypeError: Can't convert 'list' object to str implicitly

2014-02-05 Thread Chris Angelico
On Thu, Feb 6, 2014 at 5:08 PM, Dave Angel wrote: > print('The secretWord is ' + secretWord > print('The secretKey is ' + key )) http://xkcd.com/859/ ChrisA -- https://mail.python.org/mailman/listinfo/python-list

Re:[Solved]Re: Help with TypeError: Can't convert 'list' object to str implicitly

2014-02-05 Thread Dave Angel
dave em Wrote in message: > > > Fixed the error and am now onto the next issue. > > Solution was to return a list (I think) and then break out the components of > the list and put in the variable. Here is how we did it: > > secretWord = getRandomWord(words) > print('The secretWord is ' + str

Re: how to reduce bugs due to incorrect indentation

2014-02-05 Thread Asaf Las
On Thursday, February 6, 2014 5:02:09 AM UTC+2, msu...@gmail.com wrote: > I had a bug in a Python script recently. The code in question was > something along the lines of: > if a == 1: > x = y > else: > x = z > y = z + y > z = z + 1 > > While editing this file I accidentally pushed TAB on

Re: how to reduce bugs due to incorrect indentation

2014-02-05 Thread Chris Angelico
On Thu, Feb 6, 2014 at 2:08 PM, Dan Sommers wrote: > On Wed, 05 Feb 2014 19:02:09 -0800, msustik wrote: > >> My changes were elsewhere and I did not notice the above one line >> change when I looked at the diffs before commit. I should have noticed >> it... >> >> It was rare that a was 1 and there

Re: parse a csv file into a text file

2014-02-05 Thread Asaf Las
On Thursday, February 6, 2014 6:09:52 AM UTC+2, Tim Chase wrote: > On 2014-02-05 19:59, Asaf Las wrote: > From your code, > list_t = str_t.split(',') > It might have been a short-hand for obtaining the results of a CSV > row, but it might be better written something like > list_t = csv.reader([

Re: parse a csv file into a text file

2014-02-05 Thread Tim Chase
On 2014-02-05 19:59, Asaf Las wrote: > On Thursday, February 6, 2014 2:46:04 AM UTC+2, Tim Chase wrote: > > On 2014-02-05 16:10, Zhen Zhang wrote: > > Asaf recommended using string methods to split the file. Keep > > doing what you're doing (using the csv module), as it attends to > > a lot of edg

Re: parse a csv file into a text file

2014-02-05 Thread Asaf Las
On Thursday, February 6, 2014 2:46:04 AM UTC+2, Tim Chase wrote: > On 2014-02-05 16:10, Zhen Zhang wrote: > Asaf recommended using string methods to split the file. Keep doing > what you're doing (using the csv module), as it attends to a lot of > edge-cases that will trip you up otherwise. I lea

Re: how to reduce bugs due to incorrect indentation

2014-02-05 Thread Dan Sommers
On Wed, 05 Feb 2014 19:02:09 -0800, msustik wrote: > My changes were elsewhere and I did not notice the above one line > change when I looked at the diffs before commit. I should have noticed > it... > > It was rare that a was 1 and therefore the problem did not show up for > a while. (I know I s

how to reduce bugs due to incorrect indentation

2014-02-05 Thread msustik
I had a bug in a Python script recently. The code in question was something along the lines of: if a == 1: x = y else: x = z y = z + y z = z + 1 While editing this file I accidentally pushed TAB on the line with 'y = z + y'. My changes were elsewhere and I did not notice the above one l

Re: parse a csv file into a text file

2014-02-05 Thread Terry Reedy
On 2/5/2014 7:10 PM, Zhen Zhang wrote: Hi, every one. I am a second year EE student. I just started learning python for my project. I intend to parse a csv file with a format like 3520005,"Toronto (Ont.)",C ,F,2503281,2481494,F,F,0.9,1040597,979330,630.1763,3972.4,1 2466023,"Montréal (Que.)"

[Solved]Re: Help with TypeError: Can't convert 'list' object to str implicitly

2014-02-05 Thread dave em
On Wednesday, February 5, 2014 7:21:29 PM UTC-7, dave em wrote: > Hello, > > > > Background. My 11 y/o son and I have taken on the task to learn python and > work our way through the http://inventwithpython.com/chapters/ book. > > - We are currently on Chapter 9 and trying to modify the hang

Help with TypeError: Can't convert 'list' object to str implicitly

2014-02-05 Thread dave em
Hello, Background. My 11 y/o son and I have taken on the task to learn python and work our way through the http://inventwithpython.com/chapters/ book. - We are currently on Chapter 9 and trying to modify the hangman program. - the first challenge was to modify the word list into a dictionary.

Re: Python installation/cleanup management

2014-02-05 Thread Asaf Las
On Thursday, February 6, 2014 3:19:00 AM UTC+2, Asaf Las wrote: > On Thursday, February 6, 2014 1:31:58 AM UTC+2, Asaf Las wrote: so far smallest footprint one: http://my.opera.com/ruario/blog/2012/02/15/tracking-software-that-you-have-compiled-locally -- https://mail.python.org/mailman/listinf

Re: Python installation/cleanup management

2014-02-05 Thread Asaf Las
On Thursday, February 6, 2014 1:31:58 AM UTC+2, Asaf Las wrote: > > Asaf Epel repository provides paco for CentOS. Guess RH does same. paco x86_64 2.0.9-6.el6 (yet there are couple of other tools based on interception of copied files during make install) --

Re:parse a csv file into a text file

2014-02-05 Thread Dave Angel
Zhen Zhang Wrote in message: > Hi, every one. > > I am a second year EE student. > I just started learning python for my project. > > I intend to parse a csv file with a format like > > 3520005,"Toronto (Ont.)",C > ,F,2503281,2481494,F,F,0.9,1040597,979330,630.1763,3972.4,1 > 2466023,"Montr

Re: parse a csv file into a text file

2014-02-05 Thread Mark Lawrence
On 06/02/2014 00:46, Tim Chase wrote: On 2014-02-05 16:10, Zhen Zhang wrote: import csv file = open('raw.csv') Asaf recommended using string methods to split the file. Keep doing what you're doing (using the csv module), as it attends to a lot of edge-cases that will trip you up otherwise. I

Re: parse a csv file into a text file

2014-02-05 Thread Tim Chase
On 2014-02-05 16:10, Zhen Zhang wrote: > import csv > file = open('raw.csv') Asaf recommended using string methods to split the file. Keep doing what you're doing (using the csv module), as it attends to a lot of edge-cases that will trip you up otherwise. I learned this the hard way several yea

Re: parse a csv file into a text file

2014-02-05 Thread MRAB
On 2014-02-06 00:10, Zhen Zhang wrote: Hi, every one. I am a second year EE student. I just started learning python for my project. I intend to parse a csv file with a format like 3520005,"Toronto (Ont.)",C ,F,2503281,2481494,F,F,0.9,1040597,979330,630.1763,3972.4,1 2466023,"Montréal (Que.)"

Re: parse a csv file into a text file

2014-02-05 Thread Roy Smith
In article <5c268845-003f-4e24-b27a-c89e9fbfc...@googlegroups.com>, Zhen Zhang wrote: > [code] > > import csv > file = open('raw.csv') > reader = csv.reader(file) > > f = open('NicelyDone.text','w') > > for line in reader: > f.write("%s %s"%line[1],%line[5]) > > [/code] Are you using

Re: parse a csv file into a text file

2014-02-05 Thread Asaf Las
On Thursday, February 6, 2014 2:10:16 AM UTC+2, Zhen Zhang wrote: > Hi, every one. > Zhen str_t = '3520005,"Toronto (Ont.)",C ,F,2503281,2481494,F,F,0.9,1040597,979330,630.1763,3972.4,1' list_t = str_t.split(',') print(list_t) print("split result ", list_t[1], list_t[5]) print(list_t[1].split('"

parse a csv file into a text file

2014-02-05 Thread Zhen Zhang
Hi, every one. I am a second year EE student. I just started learning python for my project. I intend to parse a csv file with a format like 3520005,"Toronto (Ont.)",C ,F,2503281,2481494,F,F,0.9,1040597,979330,630.1763,3972.4,1 2466023,"Montréal (Que.)",V ,F,1620693,1583590,T,F,2.3,787060,7

Python installation/cleanup management

2014-02-05 Thread Asaf Las
Hi What is the best way to manage Python isolated from /bin /usr/bin ... installations done via source code compilation on yum/rpm based systems? there are some alternatives i guess could be done: * configure --prefix, then delete * checkinstall * fpm (questionable for python?) * make altins

Picat Stable Version 0.1 Released

2014-02-05 Thread neng . zhou
We are pleased to announce the release of the first stable version of Picat, version 0.1, on picat-lang.org. This version has undergone intensive testing, using a comprehensive unit-test suite and a collection of several hundred programs of over 70,000 lines of code in total. Picat is a simpl

Re: [OT] Usage of U+00B6 PILCROW SIGN

2014-02-05 Thread wxjmfauth
Le mercredi 5 février 2014 16:23:01 UTC+1, Ned Batchelder a écrit : > On 2/5/14 9:41 AM, wxjmfa...@gmail.com wrote: > > > If you put the FSR on the table. > > > I think I have a very correct vision of what Unicode > > > should be and*is*. (*) > > > I belong to those who know that latin-1 is unu

4th CompIMAGE - Pittsburgh, USA, Sept. 3-5, 2014

2014-02-05 Thread tava...@fe.up.pt
Dear Colleague, The 4th CompIMAGE conference (http://jessicaz.me.cmu.edu/CompImage2014) aims to bring together researchers in the area of computational modeling of objects represented in images. Different approaches, such as level set method, deformable models, optimization, geometric modeling,

Re: Calculator Problem

2014-02-05 Thread 88888 Dihedral
On Monday, February 3, 2014 5:16:44 AM UTC+8, Charlie Winn wrote: > Hey Guys i Need Help , When i run this program i get the 'None' Under the > program, see what i mean by just running it , can someone help me fix this > > > > def Addition(): > > print('Addition: What are two your numbers?

Re: Calculator Problem

2014-02-05 Thread Peter Otten
Joshua Landau wrote: > On 5 February 2014 02:22, Dan Sommers wrote: > >> On Tue, 04 Feb 2014 19:53:52 -0500, Roy Smith wrote: >> >> > In article , >> > David Hutto wrote: >> > >> >> Can anyone point out how using an int as a var is possible >> > >> > one = 42 >> > >> > (ducking and running) >>

Re: Calculator Problem

2014-02-05 Thread Joshua Landau
On 5 February 2014 02:22, Dan Sommers wrote: > On Tue, 04 Feb 2014 19:53:52 -0500, Roy Smith wrote: > > > In article , > > David Hutto wrote: > > > >> Can anyone point out how using an int as a var is possible > > > > one = 42 > > > > (ducking and running) > > int = 42 > > (ducking lower and ru

trivial import question

2014-02-05 Thread nevetsreleehw
The underscore relative to a prfixed abbb. Is to be noted -- https://mail.python.org/mailman/listinfo/python-list

Re: [OT] Usage of U+00B6 PILCROW SIGN

2014-02-05 Thread Mark Lawrence
On 05/02/2014 14:41, wxjmfa...@gmail.com wrote: Please stop sending double line spaced messages, just follow the instructions here https://wiki.python.org/moin/GoogleGroupsPython to prevent this happening, thanks. -- My fellow Pythonistas, ask not what our language can do for you, ask what y

Re: [OT] Usage of U+00B6 PILCROW SIGN

2014-02-05 Thread Ned Batchelder
On 2/5/14 9:41 AM, wxjmfa...@gmail.com wrote: If you put the FSR on the table. I think I have a very correct vision of what Unicode should be and*is*. (*) I belong to those who know that latin-1 is unusable for more than ten European languages based on latin scripts. Today, one can add German to

Re: Finding size of Variable

2014-02-05 Thread Mark Lawrence
On 05/02/2014 14:33, Ayushi Dalmia wrote: Please stop sending double line spaced messages, just follow the instructions here https://wiki.python.org/moin/GoogleGroupsPython to prevent this happening, thanks. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can

Re: [OT] Usage of U+00B6 PILCROW SIGN

2014-02-05 Thread wxjmfauth
Le mercredi 5 février 2014 00:18:35 UTC+1, Terry Reedy a écrit : > On 2/4/2014 10:21 AM, wxjmfa...@gmail.com wrote: > > > > >> I was able to discover that link by opening the page, highlighting the > > >> section header with my mouse, then clicking the pilcrow. That gives > > >> me the anchor

Re: Finding size of Variable

2014-02-05 Thread Ayushi Dalmia
On Wednesday, February 5, 2014 7:13:34 PM UTC+5:30, Dave Angel wrote: > Ayushi Dalmia Wrote in message: > > > On Wednesday, February 5, 2014 12:59:46 AM UTC+5:30, Tim Chase wrote: > > >> On 2014-02-04 14:21, Dave Angel wrote: > > >> > > >> > To get the "total" size of a list of strings, try

Re: Finding size of Variable

2014-02-05 Thread Dave Angel
Ayushi Dalmia Wrote in message: > On Wednesday, February 5, 2014 12:59:46 AM UTC+5:30, Tim Chase wrote: >> On 2014-02-04 14:21, Dave Angel wrote: >> >> > To get the "total" size of a list of strings, try (untested): >> >> > >> >> > a = sys.getsizeof (mylist ) >> >> > for item in mylist: >>

Re: kivy

2014-02-05 Thread Dave Angel
Rustom Mody Wrote in message: > On Wednesday, February 5, 2014 1:25:43 AM UTC+5:30, bharath wrote: >> please help im just frustrated after writing a long code and seeing that it >> isn't working.. > > Prior to Kernighan and Ritchie people did tend to write 'a long code' > and then check that i

Re: Finding size of Variable

2014-02-05 Thread Chris Angelico
On Wed, Feb 5, 2014 at 10:00 PM, Steven D'Aprano wrote: >> where stopWords.txt is a file of size 4KB > > My guess is that if you split a 4K file into words, then put the words > into a list, you'll probably end up with 6-8K in memory. I'd guess rather more; Python strings have a fair bit of fixed

Re: Finding size of Variable

2014-02-05 Thread Steven D'Aprano
On Tue, 04 Feb 2014 21:35:05 -0800, Ayushi Dalmia wrote: > On Wednesday, February 5, 2014 12:59:46 AM UTC+5:30, Tim Chase wrote: >> On 2014-02-04 14:21, Dave Angel wrote: >> >> > To get the "total" size of a list of strings, try (untested): >> >> > >> > a = sys.getsizeof (mylist ) >> > for ite

Re: Finding size of Variable

2014-02-05 Thread Peter Otten
Ayushi Dalmia wrote: > On Wednesday, February 5, 2014 12:51:31 AM UTC+5:30, Dave Angel wrote: >> Ayushi Dalmia Wrote in message: >> >> >> >> > >> >> > Where am I going wrong? What are the alternatives I can try? >> >> >> >> You've rejected all the alternatives so far without showing your