Re: [Tutor] Custom Function that Takes argument

2015-10-31 Thread Nym City via Tutor
Also, why the partial results. Any suggestions on how to normalize this?  Thank you. On Wednesday, October 21, 2015 5:53 AM, Alan Gauld wrote: On 21/10/15 01:18, Nym City via Tutor wrote: > def zip_search(query): >      api_key = locu_api >      url = 'https://api.

Re: [Tutor] Custom Function that Takes argument

2015-10-21 Thread Nym City via Tutor
Hello, Thank you for your feedback. Sorry it took me a while to revise my code but here is my code with the changes: import urllib2 import json locu_api = 'redacted' def locu_search(query):     api_key = locu_api     url = 'https://api.locu.com/v1_0/venue/search/?api_key=' + api_key     locality

Re: [Tutor] Custom Function that Takes argument

2015-10-12 Thread Nym City via Tutor
Thank you for your response. I updated the first portion of my code to include breaks: import urllib2 import json locu_api = 'redacted' ans=True while ans:     print ("""     1.Search by City     2.Search by Region (State Abbreviation)     3.Search by Zip     4.Exit/Quit     """)     ans=raw_i

Re: [Tutor] Custom Function that Takes argument

2015-10-11 Thread Nym City via Tutor
item['street_address'], item['categories'] # # # print zip_search(zip) ------------- The part that is not working is the initial prompt for selection. The program prompts th

Re: [Tutor] Exception Handling

2015-10-03 Thread Nym City via Tutor
Thank you (Cameron and Alan) for your review and feedback. This solved the issue perfectly!  Thank you. On Friday, October 2, 2015 11:49 PM, Cameron Simpson wrote: On 03Oct2015 00:51, ALAN GAULD wrote: >On 02/10/15 23:57, Nym City via Tutor wrote: >>socket.gaierro

[Tutor] Exception Handling

2015-10-02 Thread Nym City via Tutor
Hello, I am trying to get IP addresses for about 500 public domains but I think for some where resolution is not available - my exception handling breaks the code.  To troubleshoot, I added several Print statements to see what I was getting and it looks like my blank list is getting populated wit

Re: [Tutor] Beautiful Soup

2015-09-29 Thread Nym City via Tutor
Hello, I have personally found this tutorial to be helpful. Check it out: https://www.youtube.com/watch?v=3xQTJi2tqgk Thank you. On Tuesday, September 29, 2015 12:05 PM, Joel Goldstick wrote: On Tue, Sep 29, 2015 at 11:47 AM, Crusier wrote: > Hi > > I have recently finished rea

[Tutor] Custom Function that Takes argument

2015-09-28 Thread Nym City via Tutor
Hello, I am learning how to create custom functions and watched the tutorial online that uses API for locu to do cool stuff. I wanted to go little bit beyond the tutorial and add my own features. The problem that I am running into is that I cannot figure out how to prompt a user to input their z

Re: [Tutor] syntax error

2015-09-18 Thread Nym City via Tutor
-Perfect. Thank you. On Tuesday, September 15, 2015 5:00 AM, Alan Gauld wrote: On 15/09/15 02:41, Nym City via Tutor wrote: > Hello, > I am also just trying to understand this code and could not understand the > print statement.I would have just used: > 

Re: [Tutor] Syntax error and EOL Error

2015-09-15 Thread Nym City via Tutor
-Thank you very much for your feedback. It was definitely helpful. I will try to stay consistent with my coding style in the future projects.   On Sunday, September 13, 2015 3:01 PM, Danny Yoo wrote: On Sun, Sep 13, 2015 at 7:20 AM, Nym City via Tutor wrote: > Hello, >

Re: [Tutor] syntax error

2015-09-15 Thread Nym City via Tutor
Hello, I am also just trying to understand this code and could not understand the print statement.I would have just used: print('cost:$',gross_cost) Do you mind telling little bit about what: print('cost: ${:.2f}'.format(gross_cost)) does do and why one would use this over my plain version?  T

Re: [Tutor] Syntax error and EOL Error

2015-09-13 Thread Nym City via Tutor
(domains) DomainList = [column[1] for column in DomainList] strip_list = [item.rstrip('/') for item in DomainList] print('\n'.join(strip_list))  Thank you. On Monday, September 7, 2015 5:25 AM, Alan Gauld wrote: On 07/09/15 01:40, Nym City via Tutor wrote: > H

Re: [Tutor] Syntax error and EOL Error

2015-09-07 Thread Nym City via Tutor
ging it to 'rb' and 'w' but received the same error. Also, not sure if the next error is because of the above issue but I get syntax error when I do the last print and I do not see any syntax issue with it. As always, thanks in advance.  Thank you. On Friday, Septemb

[Tutor] Syntax error and EOL Error

2015-09-03 Thread Nym City via Tutor
Hello, I am working with a csv file that has following sample data: Rank    URL    Linking Root Domains 1    facebook.com/    9616487 2    twitter.com/    6454936 3    google.com/    5868081 4    youtube.com/    5442206 5    wordpress.org/    4051288 In my program, I am reading in this csv file, t

Re: [Tutor] Writing back to same CSV in the next column

2015-08-23 Thread Nym City via Tutor
print(ResolvedAddresses)     except socket.herror as e:     newFile.write("No resolution available for %s" % (address) + "\n") If you have any suggestions, please do share. Thank you. On Monday, August 17, 2015 4:35 AM, Alan Gaul

[Tutor] SyntaxError: unexpected EOF while parsing

2015-08-18 Thread Nym City via Tutor
Hello, I would like to know what is the reason and proper solution for the following error: SyntaxError: unexpected EOF while parsing. I am get this error usually when I am troubleshooting and comment out portion of the code and add Print() statements to see where the issues are in my code. Howe

Re: [Tutor] Writing back to same CSV in the next column

2015-08-17 Thread Nym City via Tutor
Hi, Thank you for your response. I fixed the parenthesis and it worked. I made little modification below. By default the output of the gethostbyaddr module includes three item (hostname, aliaslist, ipaddrlist). However, in my output I just what the hostname field. So I created a list but I am no

Re: [Tutor] Writing back to same CSV in the next column

2015-08-16 Thread Nym City via Tutor
ess TypeError: Can't convert 'int' object to str implicitly. Also, not sure why I keep getting SyntaxError: invalid syntax pointing to the except line. Please advise. Thank you.  Thank you. On Wednesday, August 12, 2015 7:07 AM, Nym City via Tutor wrote: Hello,

Re: [Tutor] Writing back to same CSV in the next column

2015-08-12 Thread Nym City via Tutor
hat is ok too.  I do not have the understanding of binary vs text modes. But I have found this online, can't say I understand it though: http://fileinfo.com/help/binary_vs_text_files  Thank you. On Tuesday, August 11, 2015 4:10 AM, Alan Gauld wrote: On 11/08/15 01:23,

Re: [Tutor] Writing back to same CSV in the next column

2015-08-11 Thread Nym City via Tutor
e))     newFile.write.(ResolvedAddresses + "\n")Thank you. On Sunday, August 2, 2015 7:47 PM, Nym City via Tutor wrote: Hello, Below is my program where I am reading a list of IPs from a CSV file and running it through the socket module. The result of the computati

[Tutor] Writing back to same CSV in the next column

2015-08-02 Thread Nym City via Tutor
Hello, Below is my program where I am reading a list of IPs from a CSV file and running it through the socket module. The result of the computation is stored in a variable named ResolvedAddresses. However, there are some that are not resolved and for those there is an exception. The task that I

Re: [Tutor] Socket Module

2015-07-30 Thread Nym City via Tutor
est of the loop, it worked fine. I still have couple parts to add to this project but at least this hurdle is behind. Thank you. On Tuesday, July 28, 2015 4:49 AM, Nym City via Tutor wrote: Hi Martin, Thank you for taking the time to write such a detailed response. Very much app

Re: [Tutor] Socket Module

2015-07-28 Thread Nym City via Tutor
Hi Martin, Thank you for taking the time to write such a detailed response. Very much appreciate it. I tried the code again with modifications that you suggested and even though none of the public addresses resolved; I did get little more details. I am still working on finding a solution for th

Re: [Tutor] Socket Module

2015-07-25 Thread Nym City via Tutor
k you. On Monday, July 20, 2015 5:00 AM, Alan Gauld wrote: On 20/07/15 00:55, Nym City via Tutor wrote: > Thank you for your response. I gave it another try: > As suggested, first I ran the concept just in the terminal, and it worked > fine: >>>> names =['

Re: [Tutor] Socket Module

2015-07-19 Thread Nym City via Tutor
98.139.183.24 What am I missing? Thank in advance.  Thank you. On Saturday, July 18, 2015 7:09 PM, Danny Yoo wrote: On Jul 18, 2015 3:50 PM, "Nym City via Tutor" wrote: > > Thank you all for your responses. I have a follow up question: > > So if gethostbyname_

Re: [Tutor] Socket Module

2015-07-18 Thread Nym City via Tutor
project.  Thank you. On Monday, July 13, 2015 2:59 AM, Alan Gauld wrote: On 12/07/15 23:36, Nym City via Tutor wrote: > import csv > import socket > > domains = open('top500domains.csv', 'r') > for domain in domains: >      domain = socke

[Tutor] Socket Module

2015-07-12 Thread Nym City via Tutor
Hello, I am working on a 2 individual programs. In the first program, I am taking in a list of domains in .csv format and want to get the associated IPs. In the second program, I want to import in a list of IP .csv and than get the associated domains out. Eventually I want to get both of the abo

Re: [Tutor] Loop not iterating

2015-07-05 Thread Nym City via Tutor
9:04:10PM +0000, Nym City via Tutor wrote: > Thank to very much for replying.  The second solution that you proposed > worked perfectly: > > import csv > domains = open('top500domains.csv') > domainsReader = csv.reader(domains) > domains = ["https://www."; +

Re: [Tutor] Loop not iterating

2015-07-03 Thread Nym City via Tutor
Thank to very much for replying.  The second solution that you proposed worked perfectly: import csvdomains = open('top500domains.csv')domainsReader = csv.reader(domains)domains = ["https://www."; + row[1] for row in domainsReader]for domain in domains:    print(domain) The above solution is p

Re: [Tutor] Loop not iterating

2015-06-29 Thread Nym City via Tutor
t way to format data out of lists. (I image myself creating a lot of lists and would be helpful to know how to generally handle formatting with lists)  Thanks in advance! :))  Thank you. On Sunday, June 28, 2015 10:57 PM, Steven D'Aprano wrote: Hi Nym, and welcome, O

[Tutor] Loop not iterating

2015-06-28 Thread Nym City via Tutor
Hello, I am working on my second program and its a two part progam that I want to design However, i am not sure what silly mistake I am making on the first part: Here is my code: | 2 3 4 5 6 7 | import csv domains = open('top500domains.csv') domainsReader = csv.reader(domains) domainLists = list(

[Tutor] Req Assistance with 1st Project.

2015-05-31 Thread Nym City via Tutor
Hello all, I am working on my first Python project and I need some help. Here is what my project is about. I want to be able to read in from a text file that contains a list of IP addresses (maybe even hostnames) and write out each IP in the list in the following format: "172.0.0.1" OR "10.10.10

Re: [Tutor] Help Learn python - Step by Step

2015-05-09 Thread Nym City via Tutor
I am on the same boat. I have tried using online sites like codeacademy  and courses on courser but now I am starting with this new book called "Automate The Boring Stuff with Python". So far so good. Thank you. On Saturday, May 9, 2015 8:41 AM, acolta wrote: Hi guys, I want to