[Tutor] How to write tests for main() function that does not return anything

2016-02-02 Thread Pedro Miguel
Hi guys, I'm trying to test the code in the main() but I'm a bit unsure how to go about it since I'm not passing any arguments or even returning anything other then logging. For the purposes of the example I've shortened the tree statements in the function.. Can anyone point me in the right dire

Re: [Tutor] Help with error

2016-02-02 Thread Joel Goldstick
First, Please try to be more creative with your message subject line. Help, isn't -- helpfull Second. Don't paraphrase the error, copy it from your actual terminal screen and paste it here. See below On Tue, Feb 2, 2016 at 10:37 AM, Chelsea G wrote: > Hi, > When I run my code I am getting an

Re: [Tutor] 2016-02-01 Filter STRINGS in Log File and Pass as VARAIBLE within PYTHON script

2016-02-02 Thread knnleow GOOGLE
hello Cameron, thank you for the positive input. this is my new code. NEW CODE $ more fail2ban-banned-ipAddress.py #VERSION CONTROL: #2016-01-31 - Initial build by Kuenn Leow #- fail2ban package has to be installed #- fail2ban leverage on linux iptables

[Tutor] Help with error

2016-02-02 Thread Chelsea G
Hi, When I run my code I am getting an error it says "Attribute Error: Dictionary instance has no attribute 'search'. So the whole idea for my code is to input a csv file and output results that we want. This specific piece of code def search is to search the csv file for any keyword like 'issues'

Re: [Tutor] 2016-02-01 Filter STRINGS in Log File and Pass as VARAIBLE within PYTHON script

2016-02-02 Thread knnleow GOOGLE
Sorry, forget to make use of SET() ... this is the new update. appreciate your advice if we can still optimized further... $ more fail2ban-banned-ipAddress.py #VERSION CONTROL: #2016-01-31 - Initial build by Kuenn Leow # - fail2ban package has to be installed #

Re: [Tutor] Help with error

2016-02-02 Thread Alan Gauld
On 02/02/16 15:37, Chelsea G wrote: > 'issues' and output those results into a text file. I just need some help > with figuring out how to fix the error I am receiving. Joel has already pointed out the indentation error in your class. However there is another problem... but possibly not with you

[Tutor] Fwd: RE: Finding the max value from a dictionary that does not exceed a variable's value.

2016-02-02 Thread Danny Yoo
-- Forwarded message -- From: "Danny Yoo" Date: Feb 2, 2016 1:22 PM Subject: RE: [Tutor] Finding the max value from a dictionary that does not exceed a variable's value. To: "Lawrence Lorenzo" Cc: On Feb 2, 2016 10:34 AM, "Lawrence Lorenzo" wrote: > > > I can do it with a list,

Re: [Tutor] 2016-02-01 Filter STRINGS in Log File and Pass as VARAIBLE within PYTHON script

2016-02-02 Thread Cameron Simpson
On 02Feb2016 21:14, knnleow GOOGLE wrote: Sorry, forget to make use of SET() ... this is the new update. appreciate your advice if we can still optimized further... A few remarks, interleaved below. myArray = sys.argv I would not make this a global. Instead, pass sys.argv to main a

[Tutor] File extension change

2016-02-02 Thread Chelsea G
Hi, So what I am working on is taking a csv file and only taking 2 columns from the spreadsheet and out putting that to a text file. Then taking those two columns and organize them by product(key) and outputting the description(values) that are associated. Some products have a lot of duplicate desc

Re: [Tutor] File extension change

2016-02-02 Thread Ben Finney
Chelsea G writes: > import csvimport jsonimport sysimport osfrom collections import > defaultdictfrom collections import Counter Your email client has, probably without your consent, mangled the content of your message. Please ensure your email client does not attempt to apply pretty formatting

[Tutor] date range

2016-02-02 Thread Chelsea G
Hi, So I am taking in a csv file with several rows and one of those rows in a date row. I am trying to see if I can read in a csv file and search for a certain date range like 1/2/2016 to 1/5/2016. Something like that or a bigger date range. And then I want to ouput the results to either another cs

Re: [Tutor] date range

2016-02-02 Thread Ben Finney
Chelsea G writes: > So I am taking in a csv file with several rows and one of those rows > in a date row. That doesn't make much sense, as a sepcification. CSV is by design a data format in which every data row has the same structure: the fields always have the same meaning, in the same order.