Thank you, Peter.
About OOP: company policy, can't help it.
They say it's easier to maintain and code.
But it works now.
On Thu, Dec 19, 2013 at 2:39 AM, Peter Otten <__pete...@web.de> wrote:
> Igor Korot wrote:
>
>> Hi, Peter,
>> Thank you for the great suggestion.
>>
>> I tried to implement yo
You didn't pass in self as the first arg to open. This is necessary.
S
On 19 December 2013 09:22, Igor Korot wrote:
> Hi, Peter,
> Thank you for the great suggestion.
>
> I tried to implement you code but failed.
>
> Here's what I have:
>
> class FileReader:
> def __init__(self, filena
Igor Korot wrote:
> Hi, Peter,
> Thank you for the great suggestion.
>
> I tried to implement you code but failed.
>
> Here's what I have:
>
> class FileReader:
> def __init__(self, filename, isSkip):
> self.path = filename
> self.isSkip = isSkip
>
>
Hi, Peter,
Thank you for the great suggestion.
I tried to implement you code but failed.
Here's what I have:
class FileReader:
def __init__(self, filename, isSkip):
self.path = filename
self.isSkip = isSkip
@contextmanager
def open(*args):
Igor Korot wrote:
> Hi, guys,
>
> On Tue, Dec 17, 2013 at 12:55 AM, Peter Otten <__pete...@web.de> wrote:
>> Peter Otten wrote:
>>
>>> You are still reading the complete csv file. Assuming
>>>
>>> (1) the first row of the csv contains the column names
>>> (2) you want to skip the first five rows
Hi, guys,
On Tue, Dec 17, 2013 at 12:55 AM, Peter Otten <__pete...@web.de> wrote:
> Peter Otten wrote:
>
>> You are still reading the complete csv file. Assuming
>>
>> (1) the first row of the csv contains the column names
>> (2) you want to skip the first five rows of data
Looking at the Peter's
Peter Otten wrote:
> You are still reading the complete csv file. Assuming
>
> (1) the first row of the csv contains the column names
> (2) you want to skip the first five rows of data
>
> you'd have to write
>
> reader = csv.Reader(file)
Sorry, I meant DictReader, not Reader.
> line = 0
> wh
On 2013-12-17, Igor Korot wrote:
> Hi, ALL,
> Is there a better way to do that:
>
> def Read_CSV_File(filename):
> file = open(filename, "r")
> reader = csv.DictReader(file)
> line = 1
> for row in reader:
> if line < 6:
> reader.next()
>
Igor Korot wrote:
> Hi, ALL,
> Is there a better way to do that:
>
> def Read_CSV_File(filename):
> file = open(filename, "r")
> reader = csv.DictReader(file)
> line = 1
> for row in reader:
> if line < 6:
> reader.next()
> line++
> # pr
On 17/12/2013 05:20, Igor Korot wrote:
Hi, ALL,
Is there a better way to do that:
def Read_CSV_File(filename):
file = open(filename, "r")
reader = csv.DictReader(file)
line = 1
for row in reader:
if line < 6:
reader.next()
line++
Hi Igor
You can use the following way to do this using "with" operator.
def Read_CSV_File(filename):
with open(filename, "r") as csvfile:
csvreader = csv.DictReader(csvfile)
line = 1
for row in csvreader:
if line < 6:
reader.next(
Hi, ALL,
Is there a better way to do that:
def Read_CSV_File(filename):
file = open(filename, "r")
reader = csv.DictReader(file)
line = 1
for row in reader:
if line < 6:
reader.next()
line++
# process the CSV
Thank you.
--
https://mail.
KB wrote:
On Aug 3, 3:54 pm, KB wrote:
Hi,
I am trying to download from a URL, a CSV using the following:
import re
import urllib, urllib2, cookielib
import mechanize
import csv
import numpy
import os
def return_ranking():
cj = mechanize.MSIECookieJar(delayload=True)
cj.load
On Aug 3, 3:54 pm, KB wrote:
> Hi,
>
> I am trying to download from a URL, a CSV using the following:
>
> import re
> import urllib, urllib2, cookielib
> import mechanize
> import csv
> import numpy
> import os
>
> def return_ranking():
>
> cj = mechanize.MSIECookieJar(delayload=True)
>
Hi,
I am trying to download from a URL, a CSV using the following:
import re
import urllib, urllib2, cookielib
import mechanize
import csv
import numpy
import os
def return_ranking():
cj = mechanize.MSIECookieJar(delayload=True)
cj.load_from_registry() # finds cookie index fil
15 matches
Mail list logo