Re: [Tutor] Read from large text file, find string save 1st string of each line where it appeared.

2015-12-28 Thread Cameron Simpson
On 29Dec2015 03:12, Steven D'Aprano wrote: On Mon, Dec 28, 2015 at 04:50:05PM +0530, sutanu bhattacharya wrote: suppose 61746245 is my searching string. so o/p will be [...] I don't understand the question. What is "o/p"? "output" Cheers, Cameron Simpson

Re: [Tutor] Read from large text file, find string save 1st string of each line where it appeared.

2015-12-28 Thread Walter Prins
Hi Sutanu, On 28 December 2015 at 11:20, sutanu bhattacharya < totaibhattacha...@gmail.com> wrote: > {'115160371': [45349980, 22477811, 40566595, 26947037, 16178191, 12984002, > 20087719, 19771564, 61746245, 17467721, 32233776, 31052980, 70768904, > 16113331, 12414642]} > > suppose 61746245 is

Re: [Tutor] Fwd: Read from large text file, find string save 1st string of each line where it appeared.

2015-12-28 Thread Mark Lawrence
On 28/12/2015 15:56, sutanu bhattacharya wrote: suppose 115160371 is my facebook id. 6174625 is the id of one of my friends. If i give an id ,the output will be the id of those people who are friend of 6174625. -- Forwarded message -- From: Joel Goldstick Date: Mon, Dec 28, 201

Re: [Tutor] trouble with beautiful soup

2015-12-28 Thread Mark Lawrence
On 28/12/2015 17:24, marcus lütolf wrote: Dear Pythonistas Hi Danny, I am grateful for your precise instruchtions. Yes ideed, I tried all of the steps mentioned below which I shoudn't have done fumling around with this task now for hours and days. I even tried to do it on may laptop using W7 6

Re: [Tutor] trouble with beautiful soup

2015-12-28 Thread Alan Gauld
On 28/12/15 17:24, marcus lütolf wrote: > ... (I can't cut and paste from the command window). > Actually you can :-) The secret is in the drop down menu from the icon in the top left corner of the window. You should find an Edit option which has a sub menu that allows you to select/copy text.

Re: [Tutor] trouble with beautiful soup

2015-12-28 Thread marcus lütolf
Dear Pythonistas Hi Danny, I am grateful for your precise instruchtions. Yes ideed, I tried all of the steps mentioned below which I shoudn't have done fumling around with this task now for hours and days. I even tried to do it on may laptop using W7 64bit and after deleting and reinstalling Py

Re: [Tutor] Algorithm

2015-12-28 Thread Alan Gauld
On 28/12/15 17:32, Joel Goldstick wrote: > I believe the code following should not be indented as that makes it part > of your function > > >> numlist1 = [1,2,3,4,5] >> numlist2 = [10,20,30,40,50] >> largest = get_algorithm_result(numlist1) >> print largest Ah, that makes se

Re: [Tutor] Algorithm

2015-12-28 Thread Alan Gauld
On 28/12/15 12:34, cicy felix wrote: > Create a function get_algorithm_result to implement the algorithm below > Get a list of numbers L1, L2, L3LN as argument > Assume L1 is the largest, Largest = L1 > Take next number Li from the list and do the following > If Largest is less than Li >

Re: [Tutor] Algorithm

2015-12-28 Thread Joel Goldstick
On Mon, Dec 28, 2015 at 7:34 AM, cicy felix wrote: > Hello there! > Thank you for the good work you are doing at helping newbies to python. > Please I'd like clarification with the exercise below: > > Create a function get_algorithm_result to implement the algorithm below > Get a list of number

[Tutor] Fwd: Read from large text file, find string save 1st string of each line where it appeared.

2015-12-28 Thread sutanu bhattacharya
suppose 115160371 is my facebook id. 6174625 is the id of one of my friends. If i give an id ,the output will be the id of those people who are friend of 6174625. -- Forwarded message -- From: Joel Goldstick Date: Mon, Dec 28, 2015 at 9:20 PM Subject: Re: [Tutor] Read from large

[Tutor] Read from large text file, find string save 1st string of each line where it appeared.

2015-12-28 Thread Nnamdi Anyanwu
I think what he's looking for is something similar to grep 6174625 | awk -F ":" {print $1} I don't know if there is a more efficient Python built-in used to search for the line containing 6174625 (grep in python) other than simply iterating though the entire file, with a for loop, line-by-line. Yo

[Tutor] Algorithm

2015-12-28 Thread cicy felix
Hello there! Thank you for the good work you are doing at helping newbies to python. Please I'd like clarification with the exercise below: Create a function get_algorithm_result to implement the algorithm below Get a list of numbers L1, L2, L3LN as argument Assume L1 is the largest, Larges

Re: [Tutor] Read from large text file, find string save 1st string of each line where it appeared.

2015-12-28 Thread Steven D'Aprano
On Mon, Dec 28, 2015 at 04:50:05PM +0530, sutanu bhattacharya wrote: > {'115160371': [45349980, 22477811, 40566595, 26947037, 16178191, 12984002, > 20087719, 19771564, 61746245, 17467721, 32233776, 31052980, 70768904, > 16113331, 12414642]} > > suppose 61746245 is my searching string. so o/p wil

Re: [Tutor] Read from large text file, find string save 1st string of each line where it appeared.

2015-12-28 Thread Mark Lawrence
On 28/12/2015 11:20, sutanu bhattacharya wrote: {'115160371': [45349980, 22477811, 40566595, 26947037, 16178191, 12984002, 20087719, 19771564, 61746245, 17467721, 32233776, 31052980, 70768904, 16113331, 12414642]} suppose 61746245 is my searching string. so o/p will be 115160371 (1st string).

Re: [Tutor] Read from large text file, find string save 1st string of each line where it appeared.

2015-12-28 Thread Joel Goldstick
On Mon, Dec 28, 2015 at 6:20 AM, sutanu bhattacharya < totaibhattacha...@gmail.com> wrote: > {'115160371': [45349980, 22477811, 40566595, 26947037, 16178191, 12984002, > 20087719, 19771564, 61746245, 17467721, 32233776, 31052980, 70768904, > 16113331, 12414642]} > > suppose 61746245 is my search

[Tutor] Read from large text file, find string save 1st string of each line where it appeared.

2015-12-28 Thread sutanu bhattacharya
{'115160371': [45349980, 22477811, 40566595, 26947037, 16178191, 12984002, 20087719, 19771564, 61746245, 17467721, 32233776, 31052980, 70768904, 16113331, 12414642]} suppose 61746245 is my searching string. so o/p will be 115160371 (1st string). Area in between third bracket ([ ]) is the search

Re: [Tutor] Can you help me importing the dataset?

2015-12-28 Thread Alan Gauld
On 28/12/15 09:52, Jinwoo Park wrote: > I am using python for my project and I got stuck on importing a data. > My data was generated from other program called Madgraph5 and it is .lhe > file. Never heard of it can you show us a very small example of what the data looks like? > I thought using u

[Tutor] Can you help me importing the dataset?

2015-12-28 Thread Jinwoo Park
Hello! I am using python for my project and I got stuck on importing a data. My data was generated from other program called Madgraph5 and it is .lhe file. I thought using usecols or skiprows would've worked, but this data is very messy and there are many "<...>"s in between the data (numbers) tha