Re: [Tutor] How to parse large files

2015-10-27 Thread Danny Yoo
> Instead of doing: > > diz5 = {} > ... > > we'd do something like this: > > with diz5 = dbm.open('diz5, 'c'): Sorry, I'm getting my syntax completely wrong here. My apologies. This should be: with dbm.open('diz5', 'c') as diz5: ... Apologies: I just got back from work

Re: [Tutor] How to parse large files

2015-10-27 Thread Danny Yoo
On Tue, Oct 27, 2015 at 2:32 PM, jarod_v6--- via Tutor wrote: > Hi! > I want to reads two files and create simple dictionary. Input file contain > more than 1 rows > > diz5 = {} > with open("tmp1.txt") as p: > for i in p: > lines = i.rstrip("\n").split("\t") > diz5.setde

Re: [Tutor] socket communications and threading

2015-10-27 Thread Alan Gauld
On 27/10/15 23:58, Alan Gauld wrote: that enable multiple tasks to run in parallel on a single computer. Each thread is a sub-process of the parent process. I should add that this is a bit of a simplification because threading varies in implementation depending on OS and language. Threads are

Re: [Tutor] Are there any Python-based GUI builders for tkinter

2015-10-27 Thread Alan Gauld
On 27/10/15 20:20, boB Stepp wrote: I have a friend at work and he is trying to develop GUI applications in Python, but he does not want to hand-code them. Are there any commercial or non-commercial products that would do this for him? He tried his own online search but was unsuccessful. Ther

Re: [Tutor] socket communications and threading

2015-10-27 Thread Alan Gauld
On 27/10/15 17:51, richard kappler wrote: Sorry, thought it was clear. Each of the three different data generating machines (in the test env, the python script that sends the data with 3 different device names) goes over a different thread so the developers tell me. OK, You need to get the co

Re: [Tutor] How to parse large files

2015-10-27 Thread Steven D'Aprano
On Tue, Oct 27, 2015 at 10:32:51PM +0100, jarod_v6--- via Tutor wrote: > Hi! > I want to reads two files and create simple dictionary. Input file contain > more than 1 rows Since you are talking about a tab-delimited CSV file, you should use the csv module: https://pymotw.com/2/csv/ http

Re: [Tutor] R: Re: Create complex dictionary :p:

2015-10-27 Thread Steven D'Aprano
On Tue, Oct 27, 2015 at 10:37:11PM +0100, jarod_v6--- via Tutor wrote: > Sorry, > I just realize my question are wrong: I want to knowhow to do dictionary of > dictionary in most python way: > > diz = { "A"={"e"=2,"s"=10},"B"={"e"=20,"s"=7}} Like that, except you need to use colons: diz = {"A":

Re: [Tutor] R: Re: Create complex dictionary :p:

2015-10-27 Thread Mark Lawrence
On 27/10/2015 21:37, jarod_v6--- via Tutor wrote: Sorry, I just realize my question are wrong: I want to knowhow to do dictionary of dictionary in most python way: diz = { "A"={"e"=2,"s"=10},"B"={"e"=20,"s"=7}} So I have some keys (A,B) is correlate with a new dictionary where I have other key

Re: [Tutor] How to parse large files

2015-10-27 Thread Mark Lawrence
On 27/10/2015 21:32, jarod_v6--- via Tutor wrote: Hi! I want to reads two files and create simple dictionary. Input file contain more than 1 rows diz5 = {} with open("tmp1.txt") as p: for i in p: lines = i.rstrip("\n").split("\t") diz5.setdefault(lines[0],set()).ad

[Tutor] R: Re: Create complex dictionary :p:

2015-10-27 Thread jarod_v6--- via Tutor
Sorry, I just realize my question are wrong: I want to knowhow to do dictionary of dictionary in most python way: diz = { "A"={"e"=2,"s"=10},"B"={"e"=20,"s"=7}} So I have some keys (A,B) is correlate with a new dictionary where I have other key I want to use. I want to extract for each key the

[Tutor] How to parse large files

2015-10-27 Thread jarod_v6--- via Tutor
Hi! I want to reads two files and create simple dictionary. Input file contain more than 1 rows diz5 = {} with open("tmp1.txt") as p: for i in p: lines = i.rstrip("\n").split("\t") diz5.setdefault(lines[0],set()).add(lines[1]) diz3 = {} with open("tmp2.txt") as p:

[Tutor] Are there any Python-based GUI builders for tkinter

2015-10-27 Thread boB Stepp
I have a friend at work and he is trying to develop GUI applications in Python, but he does not want to hand-code them. Are there any commercial or non-commercial products that would do this for him? He tried his own online search but was unsuccessful. His OS is Mac OS 10.10 and is using Python

Re: [Tutor] socket communications and threading

2015-10-27 Thread richard kappler
Sorry, thought it was clear. Each of the three different data generating machines (in the test env, the python script that sends the data with 3 different device names) goes over a different thread so the developers tell me. In production, those three machines are microcontrollers, not full blown c

Re: [Tutor] socket communications and threading

2015-10-27 Thread Alan Gauld
On 27/10/15 14:52, richard kappler wrote: In our test environment we have simulated this by building three vm's. VM1 has a python script that sends raw data over tcp to VM2 which parses the data and sends it over tcp to VM3 upon which we are developing our analytics apps. ... 1. The data from

[Tutor] socket communications and threading

2015-10-27 Thread richard kappler
I'm having difficulty wrapping my arms around sockets and threading, not so much from a 10,000 foot/ network perspective, but from a low level perspective. In our production environment we have three machines that generate data and forward it over tcp to a computer that stores the data, parses it

Re: [Tutor] Scraping Wikipedia Table (The retruned file is empty)

2015-10-27 Thread bruce
my $0.02 for what it might be worth.. You have some people on the list who are straight out begineers who might be doing cut/copy/paste from 'bad code'. You have people coming from other languages.. and then you have some who are trying to 'get through' something, who aren't trying to be the dev