Re: [Tutor] Custom Function that Takes argument

2015-10-31 Thread Nym City via Tutor
, why the partial results. Any suggestions on how to normalize this?  Thank you. On Wednesday, October 21, 2015 5:53 AM, Alan Gauld <alan.ga...@btinternet.com> wrote: On 21/10/15 01:18, Nym City via Tutor wrote: > def zip_search(query): >      api_key = locu_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    

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     """)    

Re: [Tutor] Custom Function that Takes argument

2015-10-11 Thread Nym City via Tutor
selection rather repeats the prompt. Hope my question make sense. Please let me know what I am missing. Thank you.  Thank you. On Monday, September 28, 2015 9:03 PM, Alan Gauld <alan.ga...@btinternet.com> wrote: On 29/09/15 00:45, Nym City via Tutor wrote: > I am learni

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 <c...@zip.com.au> wrote: On 03Oct2015 00:51, ALAN GAULD <alan.ga...@btinternet.com> wrote: >On 02/10/15

[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

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

[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

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 <alan.ga...@btinternet.com> 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

Re: [Tutor] Syntax error and EOL Error

2015-09-07 Thread Nym City via Tutor
, 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, September 4, 2015 3:23 AM, Peter Otten <__pete...@web.de> wrote: Nym City

[Tutor] Syntax error and EOL Error

2015-09-04 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,

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

2015-08-23 Thread Nym City via Tutor
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 Gauld alan.ga...@btinternet.com wrote: On 17/08/15 02:51, Nym City via Tutor

[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.

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

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

2015-08-16 Thread Nym City via Tutor
, 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 tutor@python.org wrote: Hello, Please find the two requested files attached. The 'before' file is what

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

2015-08-12 Thread Nym City via Tutor
City via Tutor wrote: import socket import csv ListOfIPAddresses = [] with open('top500ips.csv', 'rb') as f:       for line in f:           line = line.strip()           ListOfIPAddresses.append(line) f.close() You don;t need the f.close(). The 'with' structiure does that automatically

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

2015-08-11 Thread Nym City via Tutor
you. On Sunday, August 2, 2015 7:47 PM, Nym City via Tutor tutor@python.org 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 computation is stored in a variable named ResolvedAddresses

[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
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 tutor@python.org wrote: Hi Martin, Thank you for taking the time to write such a detailed response. Very much

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

Re: [Tutor] Socket Module

2015-07-25 Thread Nym City via Tutor
. On Monday, July 20, 2015 5:00 AM, Alan Gauld alan.ga...@btinternet.com 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 =['173.252.120.6

Re: [Tutor] Socket Module

2015-07-19 Thread Nym City via Tutor
danny@gmail.com wrote: On Jul 18, 2015 3:50 PM, Nym City via Tutor tutor@python.org wrote: Thank you all for your responses. I have a follow up question: So if gethostbyname_ex() takes only a single hostname string, how can I use it to go through a list of hostnames and get

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 alan.ga...@btinternet.com 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 = socket.gethostbyname(str

[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

Re: [Tutor] Loop not iterating

2015-07-05 Thread Nym City via Tutor
at 09:04:10PM +, 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.; + row[1] for row in domainsReader] for domain

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

Re: [Tutor] Loop not iterating

2015-06-29 Thread Nym City via Tutor
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 st...@pearwood.info wrote: Hi Nym, and welcome, On Sun, Jun 28, 2015 at 07:32:40PM +, Nym City

[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 =

[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

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 andrycolt...@gmail.com wrote: