On Sun, 15 Nov 2015 01:37 pm, fl wrote:
> Hi,
> I have read a couple of tutorial on yield. The following code snippet
> still gives me a shock. I am told yield is a little like return. I only
> see one yield in the tutorial examples. Here it has two yields. And there
> are three variables followin
On Sun, Nov 15, 2015 at 1:37 PM, fl wrote:
> Or are there some high relevant tutorial on this?
>
Start here:
https://docs.python.org/3/tutorial/index.html
ChrisA
--
https://mail.python.org/mailman/listinfo/python-list
Hi,
I have read a couple of tutorial on yield. The following code snippet still
gives me a shock. I am told yield is a little like return. I only see one
yield in the tutorial examples. Here it has two yields. And there are three
variables following keyword yield.
I have not tried debug function t
On 7 November 2010 18:14, Chris Rebert wrote:
> On Sun, Nov 7, 2010 at 9:56 AM, chad wrote:
>> But what happens if the input file is say 250MB? Will all 250MB be
>> loaded into memory at once?
>
> No. As I said, the file will be read from 1 line at a time, on an
> as-needed basis; which is to say
On Sun, Nov 7, 2010 at 9:56 AM, chad wrote:
> On Nov 7, 9:47 am, Chris Rebert wrote:
>> On Sun, Nov 7, 2010 at 9:34 AM, chad wrote:
>>
>> > #!/usr/local/bin/python
>>
>> > import sys
>>
>> > def construct_set(data):
>> > for line in data:
>> > lines = line.splitlines()
>> > for
On Nov 7, 9:47 am, Chris Rebert wrote:
> On Sun, Nov 7, 2010 at 9:34 AM, chad wrote:
>
>
>
>
>
> > #!/usr/local/bin/python
>
> > import sys
>
> > def construct_set(data):
> > for line in data:
> > lines = line.splitlines()
> > for curline in lines:
> > if curline.stri
On Sun, Nov 7, 2010 at 9:34 AM, chad wrote:
> #!/usr/local/bin/python
>
> import sys
>
> def construct_set(data):
> for line in data:
> lines = line.splitlines()
> for curline in lines:
> if curline.strip():
> key = curline.split(' ')
> va
On Nov 7, 9:34 am, chad wrote:
> I have an input file named 'freq' which contains the following data
>
> 123 0
>
> 133 3
> 146 1
> 200 0
> 233 10
> 400 2
>
> Now I've attempted to write a script that would take a number from the
> standard input and then
> have the program return the number in the
I have an input file named 'freq' which contains the following data
123 0
133 3
146 1
200 0
233 10
400 2
Now I've attempted to write a script that would take a number from the
standard input and then
have the program return the number in the input file that is closest
to that input file.
#!/us