Re: Basic python question

2019-10-02 Thread Aldwin Pollefeyt
Seems to work also: >>> [x,y] = output.split() On Thu, Oct 3, 2019 at 12:17 PM Aldwin Pollefeyt wrote: > Oh, sorry .. please try this: > > >>> x,y = tuple(output.split()) > > On Thu, Oct 3, 2019 at 12:11 PM Jagga Soorma wrote: > >> Thanks Aldwin th

Re: Basic python question

2019-10-02 Thread Aldwin Pollefeyt
ed your example and did: > x,y = set(output.split()) > > My assumption would be that x should be 7 and y should be 2. However, > when I print x and y it seems to be reversed (x is 2 and y is 7). Am > I missing something? > > Thanks > > On Wed, Oct 2, 2019 at

Re: Basic python question

2019-10-02 Thread Aldwin Pollefeyt
You could use: >>> x, y = set(output.split()) On Thu, Oct 3, 2019 at 11:44 AM Jagga Soorma wrote: > Hello, > > I am new to python and trying to do some basic things with python. I > am writing a script that runs a df command and I need parts of that > output saved in 2 different variables. Is

Re: numpy results in segmentation fault

2019-09-19 Thread Aldwin Pollefeyt
use: num_arr1 = numpy.array(tgt_arr1, dtype=int) num_arr2 = numpy.array(tgt_arr2, dtype=int) On Mon, Sep 16, 2019 at 5:36 PM Pradeep Patra wrote: > Yes it is crashing in the hackerrank site and the testcases fails with > segmentation fault. I tried to install numpy with 3.7.3 and it is for som

Re: Style suggestions/critiques

2019-08-20 Thread Aldwin Pollefeyt
The Zen of Python is readability? Does this look neater? x11, y11, x12, y12, x21, y21, x22, y22 = line1[0] + line1[1] + line2[0] + line2[1] Compared to tuples, lists are maybe more useful if you need to manipulate the coordinates. line1 = [ [1, 2], [3, 4] ] line1[1][0] = 5 line1[0] = [2, 3] or

Re: Want to learn python as I have donne manual testing for 12 years. Please help to share opinion how to start. Thanks

2019-07-15 Thread Aldwin Pollefeyt
Try to find small projects to solve with Python instead of using other applications. Hereby my experience: * solve or just represent a riddle or mathematical question. - Youtube channels called standupmaths and numberphile has some interesting videos about algorithms. Then it's fun trying to bui

Re: How Do You Replace Variables With Their Values?

2019-07-11 Thread Aldwin Pollefeyt
lue". On Fri, Jul 12, 2019 at 12:10 PM Ben Finney wrote: > Aldwin Pollefeyt writes: > > > dinner = {'Starters':['Fried Calamari', 'Potted crab'],'Main > > Course':['Fish', 'Meat'], 'Desert':['Cake

Re: How Do You Replace Variables With Their Values?

2019-07-11 Thread Aldwin Pollefeyt
dinner = {'Starters':['Fried Calamari', 'Potted crab'],'Main Course':['Fish', 'Meat'], 'Desert':['Cake', 'Banana Split']} # Don't ask where I got the dinner from for meal in dinner.keys(): exec(meal.replace(' ','_') + ' = list(dinner[meal])') print(Starters) print(Main_Course) print(Desert)

Re: What's wrong on using Popen's communicate method?

2019-07-03 Thread Aldwin Pollefeyt
This is same as echo abcd | notepad.exein Command Prompt. You won't see the abcd neither. On Thu, Jul 4, 2019 at 8:41 AM Chris Angelico wrote: > On Thu, Jul 4, 2019 at 10:01 AM wrote: > > > > I have the test0.py below. I expect to see 'abcd' showing in the notepad > window: > > -