Re: Import Doesn't Import

2014-10-15 Thread Terry Reedy
Perhaps you are trying too hard too fast. When I started Python, after 20 years of on and off experience with multiple languages, I went through the tutorial (on Dos, no Idle). It took about 2 hours. Then I quickly wrote the code I needed for a paid project. Do stick with 3.4.2, but use the 3.4

Re: How to debug Python IDLE?

2014-10-15 Thread Terry Reedy
On 10/15/2014 3:36 PM, ryguy7272 wrote: Please pay attention to Mark's comment about how to avoid blank line doubling. def showMaxFactor(num): count = num / 2 while count > 1: if num % count == 0: print 'largest factor of %d is %d' % \ (num, c

Re: Import Doesn't Import

2014-10-15 Thread Chris Rebert
On Wednesday, October 15, 2014, ryguy7272 wrote: > So sorry everyone. I've posted here several times today. This is VERY > frustrating. > > So, I'm reading this link. > https://docs.python.org/2/howto/urllib2.html > > Important note!: The "/2/" in the URL means those docs are for Python 2.x Wh

Python 3 is the active language, recommended for newcomers (was: Import Doesn't Import)

2014-10-15 Thread Ben Finney
ryguy7272 writes: > So, I'm reading this link. > https://docs.python.org/2/howto/urllib2.html Note that this is the documentation for Python 2, which is obsolescent. It has had a long life, so references to Python on the web are still dominantly about that legacy version. Your confusion is quite

Re: Question About Running Python code

2014-10-15 Thread Ian Kelly
On Oct 15, 2014 7:04 PM, "Cameron Simpson" wrote: > > On 15Oct2014 16:09, Dan Stromberg wrote: >> >> On Wed, Oct 15, 2014 at 3:50 PM, ryguy7272 wrote: >>> >>> #1) That's very bizarre to mix single quotes and double quotes in a single language. Does Python actually mix single quotes and do

Re: Import Doesn't Import

2014-10-15 Thread Dan Stromberg
On Wed, Oct 15, 2014 at 5:44 PM, ryguy7272 wrote: > Either this is the most brilliant thing ever invented, or it's the biggest > piece of shit ever invented. I just can't tell. All I know for sure, is > that it doesn't do ANYTHING that I tell it to do. Maybe you should decide whether you wan

Re: Import Doesn't Import

2014-10-15 Thread MRAB
On 2014-10-16 01:40, ryguy7272 wrote: So sorry everyone. I've posted here several times today. This is VERY frustrating. > So, I'm reading this link. > https://docs.python.org/2/howto/urllib2.html > > > Fetching URLs > The simplest way to use urllib2 is as follows: > import urllib2 > response

Re: Import Doesn't Import

2014-10-15 Thread Dan Stromberg
On Wed, Oct 15, 2014 at 5:40 PM, ryguy7272 wrote: > > ImportError: No module named 'urllib2' http://stackoverflow.com/questions/2792650/python3-error-import-error-no-module-name-urllib -- https://mail.python.org/mailman/listinfo/python-list

Re: Question About Running Python code

2014-10-15 Thread Cameron Simpson
On 15Oct2014 16:09, Dan Stromberg wrote: On Wed, Oct 15, 2014 at 3:50 PM, ryguy7272 wrote: #1) That's very bizarre to mix single quotes and double quotes in a single language. Does Python actually mix single quotes and double quotes? I'm not sure what you mean by "mix". C uses single

Re: Import Doesn't Import

2014-10-15 Thread Chris Angelico
On Thu, Oct 16, 2014 at 11:40 AM, ryguy7272 wrote: > I totally don't understand this language. Import means import. Right. > WTF! Yes, but import from where? If you ask Python - or any other language - to "import asfadgt4tfihavzcxvzxcvaerg", do you expect it to succeed? It doesn't exist.

Re: Import Doesn't Import

2014-10-15 Thread ryguy7272
On Wednesday, October 15, 2014 8:40:40 PM UTC-4, ryguy7272 wrote: > So sorry everyone. I've posted here several times today. This is VERY > frustrating. > > > > So, I'm reading this link. > > https://docs.python.org/2/howto/urllib2.html > > > > > > Fetching URLs > > The simplest way to

Import Doesn't Import

2014-10-15 Thread ryguy7272
So sorry everyone. I've posted here several times today. This is VERY frustrating. So, I'm reading this link. https://docs.python.org/2/howto/urllib2.html Fetching URLs The simplest way to use urllib2 is as follows: import urllib2 response = urllib2.urlopen('http://python.org/') html = respon

Re: Is there an easy way to control indents in Python

2014-10-15 Thread alex23
On 16/10/2014 12:32 AM, Chris “Kwpolska” Warrick wrote: It should parse this as else: print 'false' print 'done' Why? Because things like `print 'done'` usually have an empty line before it: if True: print 'true' else: print 'false' print 'done' That should be parsed the way you w

Re: Question About Running Python code

2014-10-15 Thread Dan Stromberg
On Wed, Oct 15, 2014 at 3:50 PM, ryguy7272 wrote: > I'm trying to run this script (using IDLE 3.4) > I would be most appreciative if someone could respond to a few questions. > > The error that I get is this. > 'invalid syntax' You may get better help if you give the context of this message. >

Question About Running Python code

2014-10-15 Thread ryguy7272
I'm trying to run this script (using IDLE 3.4) #!/usr/bin/env python import urllib2 import pytz import pandas as pd from bs4 import BeautifulSoup from datetime import datetime from pandas.io.data import DataReader SITE = "http://en.wikipedia.org/wiki/List_of_S%26P_500_companies"; START = datet

Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Dave Angel
Anurag Patibandla Wrote in message: > On Wednesday, October 15, 2014 1:35:43 PM UTC-4, Rustom Mody wrote: >> On Wednesday, October 15, 2014 10:51:11 PM UTC+5:30, Anurag Patibandla wrote: >> >> > Here is my sample dict if that helps: >> >> > >> >> > >> >> > >> >> > json = {"1": {"Status": "

Re: How to debug Python IDLE?

2014-10-15 Thread Mark Lawrence
On 15/10/2014 21:45, ryguy7272 wrote: On Wednesday, October 15, 2014 3:10:05 PM UTC-4, ryguy7272 wrote: I'm wondering how to debug code in IDLE Python 3.4. I found this. http://www.cs.uky.edu/~paulp/CS115F11/notes/debug/debug.html That looks pretty helpful, but mine is nothing like that. A

Re: How to debug Python IDLE?

2014-10-15 Thread ryguy7272
On Wednesday, October 15, 2014 3:10:05 PM UTC-4, ryguy7272 wrote: > I'm wondering how to debug code in IDLE Python 3.4. I found this. > > http://www.cs.uky.edu/~paulp/CS115F11/notes/debug/debug.html > > > > That looks pretty helpful, but mine is nothing like that. All my controls > are greye

Re: Creating a counter

2014-10-15 Thread Gary Herron
On 10/15/2014 11:39 AM, Shiva wrote: Hi, I am trying to search a string through files in a directory - however while Python script works on it and writes a log - I want to present the user with count of number of strings found. So it should increment for each string found. How do I implement it

Re: How to debug Python IDLE?

2014-10-15 Thread MRAB
On 2014-10-15 20:36, ryguy7272 wrote: On Wednesday, October 15, 2014 3:23:22 PM UTC-4, Terry Reedy wrote: On 10/15/2014 3:09 PM, ryguy7272 wrote: > I'm wondering how to debug code in IDLE Python 3.4. I found this. Use 3.4.2, which has an important bugfix for debugger. > http://www.cs.uky

Re: Creating a counter

2014-10-15 Thread MRAB
On 2014-10-15 20:24, Vincent Vande Vyvre wrote: Le 15/10/2014 20:39, Shiva a écrit : Hi, I am trying to search a string through files in a directory - however while Python script works on it and writes a log - I want to present the user with count of number of strings found. So it should increm

Re: How to debug Python IDLE?

2014-10-15 Thread ryguy7272
On Wednesday, October 15, 2014 3:23:22 PM UTC-4, Terry Reedy wrote: > On 10/15/2014 3:09 PM, ryguy7272 wrote: > > > I'm wondering how to debug code in IDLE Python 3.4. I found this. > > > > Use 3.4.2, which has an important bugfix for debugger. > > > > > http://www.cs.uky.edu/~paulp/CS115F1

Re: Creating a counter

2014-10-15 Thread Vincent Vande Vyvre
Le 15/10/2014 20:39, Shiva a écrit : Hi, I am trying to search a string through files in a directory - however while Python script works on it and writes a log - I want to present the user with count of number of strings found. So it should increment for each string found. How do I implement it

Re: Creating a counter

2014-10-15 Thread Terry Reedy
On 10/15/2014 2:39 PM, Shiva wrote: Hi, I am trying to search a string through files in a directory - however while Python script works on it and writes a log - I want to present the user with count of number of strings found. So it should increment for each string found. How do I implement it?

Re: Is there an easy way to control indents in Python

2014-10-15 Thread Ian Kelly
On Wed, Oct 15, 2014 at 11:12 AM, Terry Reedy wrote: > On 10/15/2014 10:32 AM, Chris “Kwpolska” Warrick wrote: >> It should parse this as >> >> else: >> print 'false' >> print 'done' >> >> Why? Because things like `print 'done'` usually have an empty line before >> it: > > > There is no

Re: tkinter (Tkinter ;-) )

2014-10-15 Thread Terry Reedy
On 10/15/2014 3:12 PM, tntsu...@googlemail.com wrote: hi guys, can you help me please... i installed python 3.4.2 What system? > and the IEP editor... I have no idea what that is. now i want to program a little thingy with a window, a button and some entry fields that are connected to a s

Re: How to debug Python IDLE?

2014-10-15 Thread Terry Reedy
On 10/15/2014 3:09 PM, ryguy7272 wrote: I'm wondering how to debug code in IDLE Python 3.4. I found this. Use 3.4.2, which has an important bugfix for debugger. http://www.cs.uky.edu/~paulp/CS115F11/notes/debug/debug.html That looks pretty helpful, but mine is nothing like that. All my

Re: Creating a counter

2014-10-15 Thread Ian Kelly
On Wed, Oct 15, 2014 at 12:39 PM, Shiva wrote: > Hi, > > I am trying to search a string through files in a directory - however while > Python script works on it and writes a log - I want to present the user with > count of number of strings found. So it should increment for each string > found. >

tkinter (Tkinter ;-) )

2014-10-15 Thread tntsugar
hi guys, can you help me please... i installed python 3.4.2 and the IEP editor... now i want to program a little thingy with a window, a button and some entry fields that are connected to a simple calculation... the IEP shows me "3.4.2 without GUI"... strange... in the instalation i see the pa

How to debug Python IDLE?

2014-10-15 Thread ryguy7272
I'm wondering how to debug code in IDLE Python 3.4. I found this. http://www.cs.uky.edu/~paulp/CS115F11/notes/debug/debug.html That looks pretty helpful, but mine is nothing like that. All my controls are greyed out. The debugger does basically...nothing. All I get is messages like this. [D

Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Anurag Patibandla
On Wednesday, October 15, 2014 1:41:13 PM UTC-4, Dave Angel wrote: > Anurag Patibandla Wrote in message: > > > Thanks for the response. > > > Here is the code that I have tried. > > > > > > from operator import itemgetter > > > keys = json.keys() > > > order = list(keys) > > > q1 = int(rou

Creating a counter

2014-10-15 Thread Shiva
Hi, I am trying to search a string through files in a directory - however while Python script works on it and writes a log - I want to present the user with count of number of strings found. So it should increment for each string found. How do I implement it? If I use a print() within a if condi

Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Anurag Patibandla
On Wednesday, October 15, 2014 1:35:43 PM UTC-4, Rustom Mody wrote: > On Wednesday, October 15, 2014 10:51:11 PM UTC+5:30, Anurag Patibandla wrote: > > > Here is my sample dict if that helps: > > > > > > > > > > > > json = {"1": {"Status": "Submitted", "Startdate": ["01/01/2011"], > > "End

Re:[ANN] pdb-clone 1.9 - a fast clone of pdb with the remote debugging and attach features

2014-10-15 Thread Dave Angel
Xavier de Gaye Wrote in message: > pdb-clone 1.9 has been released at Pypi: > https://pypi.python.org/pypi/pdb-clone > > Features: >* Improve significantly pdb performance. With breakpoints, pdb-clone runs > just above the speed of the interpreter while pdb runs at 10 to 100 times the > sp

Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Dave Angel
Anurag Patibandla Wrote in message: > dicts = dict(lists) > print dicts > print dict[0] > > Print dicts works as expected giving me the combine dictionary values. But > when I say dict[0]. I see the error: > TypeError: 'type' object has no attribute '__getitem__' > Of course. You

Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Dave Angel
Anurag Patibandla Wrote in message: > On Wednesday, October 15, 2014 1:10:41 PM UTC-4, Rustom Mody wrote: >> On Wednesday, October 15, 2014 10:30:49 PM UTC+5:30, Anurag Patibandla wrote: >> >> > keys = json.keys() >> >> > order = list(keys) >> >> > q1 = int(round(len(keys)*0.2)) >> >> > q2 = i

Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Dave Angel
Anurag Patibandla Wrote in message: > Thanks for the response. > Here is the code that I have tried. > > from operator import itemgetter > keys = json.keys() > order = list(keys) > q1 = int(round(len(keys)*0.2)) > q2 = int(round(len(keys)*0.3)) > q3 = int(round(len(keys)*0.5)) > b = [q1,q2,q3] >

Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Rustom Mody
On Wednesday, October 15, 2014 10:51:11 PM UTC+5:30, Anurag Patibandla wrote: > Here is my sample dict if that helps: > > > > json = {"1": {"Status": "Submitted", "Startdate": ["01/01/2011"], "Enddate": > ["02/02/2012"], "Job_ID": 1, "m_Quantile": "80", "m_Controller": "Python", > "m_Method":

Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Anurag Patibandla
Here is my sample dict if that helps: json = {"1": {"Status": "Submitted", "Startdate": ["01/01/2011"], "Enddate": ["02/02/2012"], "Job_ID": 1, "m_Quantile": "80", "m_Controller": "Python", "m_Method": "Distributed", "Allocation_3": ["50"], "Allocation_2": ["30"], "Allocation_1": ["20"], "Note"

Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Anurag Patibandla
On Wednesday, October 15, 2014 1:10:41 PM UTC-4, Rustom Mody wrote: > On Wednesday, October 15, 2014 10:30:49 PM UTC+5:30, Anurag Patibandla wrote: > > > keys = json.keys() > > > order = list(keys) > > > q1 = int(round(len(keys)*0.2)) > > > q2 = int(round(len(keys)*0.3)) > > > q3 = int(round(l

Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Rustom Mody
On Wednesday, October 15, 2014 10:30:49 PM UTC+5:30, Anurag Patibandla wrote: > keys = json.keys() > order = list(keys) > q1 = int(round(len(keys)*0.2)) > q2 = int(round(len(keys)*0.3)) > q3 = int(round(len(keys)*0.5)) > b = [q1,q2,q3] > n=0 > for i in b: > queues = order[n:n+i] > n = n+i

Re: Is there an easy way to control indents in Python

2014-10-15 Thread Terry Reedy
On 10/15/2014 10:32 AM, Chris “Kwpolska” Warrick wrote: On Wed, Oct 15, 2014 at 9:27 AM, alex23 wrote: On 15/10/2014 12:23 PM, Juan Christian wrote: Using PyCharm is easy: File > Settings > (IDE Settings) Editor > Smart Keys > Reformat on paste > choose "Reformat Block" This isn't as s

Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Anurag Patibandla
keys = json.keys() order = list(keys) q1 = int(round(len(keys)*0.2)) q2 = int(round(len(keys)*0.3)) q3 = int(round(len(keys)*0.5)) b = [q1,q2,q3] n=0 for i in b: queues = order[n:n+i] n = n+i lists = [(queues[j], json.get(queues[j])) for j in range(len(queues))] dicts

Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Rustom Mody
On Wednesday, October 15, 2014 10:13:18 PM UTC+5:30, Rustom Mody wrote: > On Wednesday, October 15, 2014 9:58:49 PM UTC+5:30, Anurag Patibandla wrote: > > First the values printed by > > '[(queues[j], json.get(queues[j])) for j in range(len(queues))] ' > > is a list, so I tried to convert it into a

Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Anurag Patibandla
keys = json.keys() order = list(keys) q1 = int(round(len(keys)*0.2)) q2 = int(round(len(keys)*0.3)) q3 = int(round(len(keys)*0.5)) b = [q1,q2,q3] n=0 for i in b: queues = order[n:n+i] n = n+i #print queues #print [(queues[j], json.get(queues[j])) for j in range(len(queues))

Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Rustom Mody
On Wednesday, October 15, 2014 9:58:49 PM UTC+5:30, Anurag Patibandla wrote: > First the values printed by > '[(queues[j], json.get(queues[j])) for j in range(len(queues))] ' > is a list, so I tried to convert it into a dict using dict(). > And then I tried doing dict[0] but there is an error which

Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Anurag Patibandla
First the values printed by '[(queues[j], json.get(queues[j])) for j in range(len(queues))] ' is a list, so I tried to convert it into a dict using dict(). And then I tried doing dict[0] but there is an error which says: 'type' object has no attribute '__getitem__' -- https://mail.python.org/mail

Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Rustom Mody
On Wednesday, October 15, 2014 9:22:48 PM UTC+5:30, Anurag Patibandla wrote: > Thanks Rustom for the advice. > I am new to Python and getting struck at some basic things. How do I assign > the values that I am printing to 3 variables say dict1, dict2, dict3? > When I try to assign them before the

Re: CLI framework using python

2014-10-15 Thread vijnaana bhairava
Hi Naoki, I am new to python programming. Getting used to writing basic scripts to understand python. To understand 'Click' i may need some more guidance. For e.g if i were to do 'ifconfig -a' from Click, how would the program look like. That will help me get started. What i am looking for is

Re: Parsing Python dictionary with multiple objects

2014-10-15 Thread Anurag Patibandla
Thanks Rustom for the advice. I am new to Python and getting struck at some basic things. How do I assign the values that I am printing to 3 variables say dict1, dict2, dict3? When I try to assign them before the print statement like this: d1, d2, d3 =[(queues[j], json.get(queues[j])) for j in ran

Re: Is there an easy way to control indents in Python

2014-10-15 Thread Chris “Kwpolska” Warrick
On Wed, Oct 15, 2014 at 9:27 AM, alex23 wrote: > On 15/10/2014 12:23 PM, Juan Christian wrote: >> >> Using PyCharm is easy: >> >> File > Settings > (IDE Settings) Editor > Smart Keys > Reformat on paste >> > choose "Reformat Block" > > > > This isn't as straight forward as you imply. Say I have m

Re: Help with parsing a dict from Vendor's API?

2014-10-15 Thread Nick Ellson
Thank you Peter! That makes sense, and I did find "pprint" that dumped it out aligned so I could actually see the nested layers you are referring to. That got me my IP's. :-) I'll play with this now and see if I can harvest something targeted.. Like list all device host names running code 4.1

[ANN] pdb-clone 1.9 - a fast clone of pdb with the remote debugging and attach features

2014-10-15 Thread Xavier de Gaye
pdb-clone 1.9 has been released at Pypi: https://pypi.python.org/pypi/pdb-clone Features: * Improve significantly pdb performance. With breakpoints, pdb-clone runs just above the speed of the interpreter while pdb runs at 10 to 100 times the speed of the interpreter. * Extend pdb with remo

Re: Help with parsing a dict from Vendor's API?

2014-10-15 Thread Peter Otten
Nick Ellson wrote: > Hello! > > I have a very specific question related to the output of a Vendors API > (Palo Alto Networks "pan.xapi" and how I might farm data from this output. > I am new to python, doing well in the tutorials, but this is an automation > task at work and I know the rest will

Re: Jython or Pyton issue-- Kindly Help me....

2014-10-15 Thread Peter Otten
Venugopal Reddy wrote: > Thanks for Help Sir, > > Am using " for feature in tree.findall( > > ".//{urn:ford/interface/VehicleOrder/LegacyFeatureMapping/v2}PortInstalledOptionFeature"): > ) " > > Please sir help me > > Here also this findall Method is not return any list value

Re: Jython or Pyton issue-- Kindly Help me....

2014-10-15 Thread Venugopal Reddy
Thanks for Help Sir, Am using " for feature in tree.findall( ".//{urn:ford/interface/VehicleOrder/LegacyFeatureMapping/v2}PortInstalledOptionFeature"): ) " Please sir help me Here also this findall Method is not return any list values. On Wednesday, October 15, 2014 1:03:00 PM UTC

Help with parsing a dict from Vendor's API?

2014-10-15 Thread Nick Ellson
Hello! I have a very specific question related to the output of a Vendors API (Palo Alto Networks "pan.xapi" and how I might farm data from this output. I am new to python, doing well in the tutorials, but this is an automation task at work and I know the rest will be much easier once i get past t

Re: Code Review for Paper, Rock, Scissors

2014-10-15 Thread Larry Hudson
On 10/14/2014 01:04 AM, Revenant wrote: Hi all! I'm new to Python and programming in general, and am trying to learn as much as I can about it. Anyway, for a basic first program I made a simple game of Paper, Rock, Scissors. For this program, I incorporated a main menu that presented three d

Re: Jython or Pyton issue-- Kindly Help me....

2014-10-15 Thread Peter Otten
Venugopal Reddy wrote: > Actuvally am having below XML File: > > > xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/";> > xmlns:a="urn:ford/VehicleOrder/LegacyFeatureMapping/v2.0" > xmlns:b="urn:ford/VehicleOrder/SingleOrderEdit/v1.0" > xmlns:c="urn:ford/interface/VehicleOrder/LegacyFe

Re: Is there an easy way to control indents in Python

2014-10-15 Thread alex23
On 15/10/2014 12:23 PM, Juan Christian wrote: Using PyCharm is easy: File > Settings > (IDE Settings) Editor > Smart Keys > Reformat on paste > choose "Reformat Block" This isn't as straight forward as you imply. Say I have misindented code like this: if True: print 'true' els

reading output from a .sol file

2014-10-15 Thread varun7rs
Hello everyone, I have a .sol file at my hand and I wish to make it an xml file so that its a bit more convenient to read and skim off data from an xml file. But to do that, I need to write a function to read the values in the .sol file. What I intend is when I read the line z_ something, i nee