Re: [Tutor] Using pip

2018-07-05 Thread Alan Gauld via Tutor
On 05/07/18 17:03, Hlavin, Matthew (GSFC-5460)[GSFC INTERNS] wrote: > install the library using the line: > $ pip install -U pyvisa > When I type this line, I get a syntax error The most common reason is that you are trying to type it at the Python >>> prompt. It should be typed at the OS prompt.

Re: [Tutor] Need all values from while loop - only receiving one

2018-07-04 Thread Alan Gauld via Tutor
On 04/07/18 12:08, Daryl Heppner wrote: > If you have any suggestions for continued self-learning (books, > courses, etc.) I'd appreciate any tips. So far as OOP goes you can't go far wrong with the latest version of Grady Booch's OOAD book. I've read both the previous versions and the latest

Re: [Tutor] Need all values from while loop - only receiving one

2018-07-03 Thread Alan Gauld via Tutor
On 04/07/18 01:08, Alan Gauld via Tutor wrote: > # Now the main code just needs the outer loops: > tree = ET.parse(r'\\DealData.xml') > root = tree.getroot() > deals = [] > for deal in root.findall("Deals"): > for dl in deal.findall("Deal&q

Re: [Tutor] Need all values from while loop - only receiving one

2018-07-03 Thread Alan Gauld via Tutor
On 03/07/18 20:39, Daryl Heppner wrote: > The idea of a class is something I'd unsuccessfully tried but I'm up > for the challenge! I'm very comfortable in Transact SQL but OOP is > new to me. OK, What I meant by using a class was to define one (or more?) that encompassed all the data in one

Re: [Tutor] C++ or Python?

2018-07-03 Thread Alan Gauld via Tutor
On 03/07/18 14:48, Bellamy Baron wrote: > I have heard C++ is faster than python and I have a few questions > 1.Is there a way to make python run just as fast Kind of. Nearly. But its limited to specific types of program. The most common approach is to identify the slow bits and rewrite them in

Re: [Tutor] Need all values from while loop - only receiving one

2018-07-03 Thread Alan Gauld via Tutor
On 02/07/18 23:52, Daryl Heppner wrote: > The two While Loops are the part I'm struggling with. The goal is to > list each bill month number and date for each month in the term. When you need multiple values you need to use a collection type such as a list or tuple. Your problem is that you are

Re: [Tutor] Help

2018-07-03 Thread Alan Gauld via Tutor
On 03/07/18 06:23, Adam Jones wrote: > Good day, I am currently checking a piece of arcpy code. Where a point is > shifted within a set distance to protect the privacy of said point. Please > see the code below, and please advise me or correct the code where it is > needed It would help us to

Re: [Tutor] Need all values from while loop - only receiving one

2018-07-02 Thread Alan Gauld via Tutor
On 02/07/18 21:06, Daryl Heppner wrote: > I'm trying to calculate the amount of rent per lease for the life of > the lease, by month. The following code provides the correct results > except for the monthnum and billper. > The while loop (below) returns the first value correctly but stops >

Re: [Tutor] how to change the command "string" on a tkinter Button?

2018-07-02 Thread Alan Gauld via Tutor
On 01/07/18 23:34, Alan Gauld via Tutor wrote: > Realize that you made a mistake, get the original > version back > > co -l -v1.1 myfile.py Oops, a bit rusty. The command should be: co -l1.1 myfile.py -- Alan G Author of the Learn to Program web site http://www.alan-g

Re: [Tutor] why can use a widget assigned to a variable or just use it on it's own?

2018-07-02 Thread Alan Gauld via Tutor
On 02/07/18 02:54, Chris Roy-Smith wrote: > If I have grasped things correctly a widget is an object. Every value in Python is an object. numbers, strings, lists, functions, instances of classes. All are objects. You can see that by using the dir() function on them: >>> dir(5) ['__abs__',

Re: [Tutor] how to change the command "string" on a tkinter Button?

2018-07-01 Thread Alan Gauld via Tutor
On 01/07/18 11:33, Chris Roy-Smith wrote: >> Even better would be to learn a form of VCS (version control system) > I don't know anything about these tools, VCS store versions of a file. You can check for differences between versions, restore previous versions, even merge different versions.

Re: [Tutor] how to change the command "string" on a tkinter Button?

2018-07-01 Thread Alan Gauld via Tutor
On 01/07/18 09:15, Chris Roy-Smith wrote: >> def cmd2(): print('This is number 2') > I was hoping eventually to generate the command form the results of a > database query, not knowing  the exact command until run time. Perhaps > what I was trying to achieve is too close to self modifying code,

Re: [Tutor] RAD GUI Development (like Visual Studio/VBA)

2018-06-30 Thread Alan Gauld via Tutor
On 30/06/18 11:50, Shall, Sydney wrote: >> And if you want to try using Jython or MacPython(?) >> you can use the native GUI builders for those: >> - Eclipse/Netbeans (Java) >> - XDeveloper (MacOS) - I tried this once and it kind of works... >> > Alan, > > Could you expand a bit on the use of

Re: [Tutor] how to change the command "string" on a tkinter Button?

2018-06-30 Thread Alan Gauld via Tutor
On 30/06/18 03:55, Chris Roy-Smith wrote: > I am trying to change the command of a tkinter Button in my program. > Eventually I want to be able to do this to many buttons. Since I'm not 100% sure if you mean the command or the label or both here is a simple example that does both...

Re: [Tutor] RAD GUI Development (like Visual Studio/VBA)

2018-06-29 Thread Alan Gauld via Tutor
On 29/06/18 16:05, Glen wrote: > Can someone advise on a RAD, drag and drop style graphical form/dialog > creator? Akin to VBA or Visual Studio that will work with Python? There is nothing even close to the VB GUI builder for Python. That's because Python has to cover many GUI frameworks, VB

Re: [Tutor] CSV Read

2018-06-29 Thread Alan Gauld via Tutor
On 29/06/18 13:18, Sergio Rojas wrote: > # read the whole file > with open(thefilename, 'r') as theFile: contentfile = theFile.read() > > # split the file in lines according to the newline character "\n" > templines = [] > for line in contentfile.splitlines(): >

Re: [Tutor] programmer raspberry

2018-06-29 Thread Alan Gauld via Tutor
On 29/06/18 10:08, Mathieu Sollier wrote: > Bonjour, > J’essaye de programmer un Raspberry pi 3 modèle B+ composé d’un écran tactile > devant notamment allumé mon pc via cette interface. > Auriez vous des conseils pour réaliser cela ? et pour l’interface graphique ? > Cordialement. > Provenance :

Re: [Tutor] CSV Read

2018-06-25 Thread Alan Gauld via Tutor
On 25/06/18 20:35, Giulia Marcoux wrote: > Hello, > > I am a student learning python, and i am running into some difficulties. I > am tryign to read a csv file that has different delimiters for different > rows: Example: > > Format:V1.1 > Model: R > Step Size: 10mm > Distance: 10cm > Gain: 1000

Re: [Tutor] getting back my listbox items

2018-06-24 Thread Alan Gauld via Tutor
On 24/06/18 18:26, Ali M wrote: Just a quick observation, its too late to read it in detail... > def update_list(self): > search_term = self.search_var.get() > for item in self.listbox.get(0, tk.END): > if search_term.lower() in item: >

Re: [Tutor] Installing Scrapy using Pip

2018-06-23 Thread Alan Gauld via Tutor
On 23/06/18 17:56, Andrew Gabler wrote: > I am trying to install Scrapy using pip and keep getting an error message. It would help a lot if you would show us the error message. Otherwise we are just guessing. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/

Re: [Tutor] Parsing and collecting keywords from a webpage

2018-06-21 Thread Alan Gauld via Tutor
On 20/06/18 20:32, Daniel Bosah wrote: > reg = pattern.findall(str(soup)) > > for i in reg: > if i in reg and paul: # this loop checks to see if elements are in > both the regexed parsed list and the list. No it doesn't. It checks if i is in reg and if paul is non empty - which it

Re: [Tutor] Parsing and collecting keywords from a webpage

2018-06-20 Thread Alan Gauld via Tutor
On 20/06/18 20:32, Daniel Bosah wrote: > # coding: latin-1 > from bs4 import BeautifulSoup > from urllib.request import urlopen > import re > > #new point to add... make rest of function then compare a list of monuments > notaries ( such as blvd, road, street, etc.) to a list of words containing

Re: [Tutor] What's the difference between calling a method with parenthesis vs. without it?

2018-06-19 Thread Alan Gauld via Tutor
On 19/06/18 16:52, C W wrote: > Thank you all. I'm relatively new to OOP, I think that's where the problem > is. It's different from C or any C alike language. True, but even in C you can have pointers to functions which work in a similar fashion. > I'm still figuring out what's under the hood

Re: [Tutor] Recursion

2018-06-18 Thread Alan Gauld via Tutor
On 18/06/18 23:12, Roger Lea Scherer wrote: > My foggy understanding of recursion is probably the reason I can't figure > this out. When turtle draws this program there is an orange line in the > green which I would prefer not to have. I've tried all I could think of, > but can't get the orange

Re: [Tutor] What's the difference between calling a method with parenthesis vs. without it?

2018-06-18 Thread Alan Gauld via Tutor
On 17/06/18 19:02, C W wrote: > I never figured out when to call a method with parenthesis, when is it not? You call anything in Python (function, method, class, etc) using parentheses. The parentheses are what makes it a call. When you don't use parentheses you are referencing the callable

Re: [Tutor] I get an error while search in my Entry field

2018-06-18 Thread Alan Gauld via Tutor
On 17/06/18 23:59, Ali M wrote: > def update_list(self): > search_term = self.search_var.get() > self.listbox.delete(0, tk.END) > for item in self.listbox: The above pair of lines look odd. You delete everything on the listbox then try to iterate over it? Is that

Re: [Tutor] In matplotlib, why are there axes classes vs. axes API? Why not list them under one documentation?

2018-06-16 Thread Alan Gauld via Tutor
On 16/06/18 05:49, Mike C wrote: > I can only compare to the R language I've used. If there is an issue, > say a function freezes at startup, one user brings it up to the list,> when > the respective maintainer sees the bug, it is usually addressed Which is fine if there is a team working onthe

Re: [Tutor] In matplotlib, why are there axes classes vs. axes API? Why not list them under one documentation?

2018-06-15 Thread Alan Gauld via Tutor
On 15/06/18 17:35, C W wrote: > Why haven't the developers fixed the problem? This is open source, developed by volunteers to meet their own needs primarily and others by happy coincidence. If the existing solution meets the needs of the developers they have no incentive to spend time to

Re: [Tutor] SLICING

2018-06-15 Thread Alan Gauld via Tutor
On 15/06/18 14:57, kenneth yashim wrote: > please im new to python or any other programming language. please i want to > understand how slicing works > > [start,stop,step] > 'abc'[0:3] > 'abc' > 'abc'[0:-1] > 'ab' > > why does 'abc'[2:1] or 'abc'[2:1] print ' ' instead of 'c'???

Re: [Tutor] How default arg of function works

2018-06-14 Thread Alan Gauld via Tutor
On 14/06/18 08:40, Deepak Dixit wrote: > You mean that for default args and passed args of mutable type, python uses > different object and same reference will be used for further calling of the > function. Yes, the default argument object is created when the function is defined (ie before it is

Re: [Tutor] How default arg of function works

2018-06-14 Thread Alan Gauld via Tutor
On 14/06/18 08:04, Deepak Dixit wrote: > def test2(nums=[]): > nums.append(len(nums)); > return nums > > print 'test2()', test2() > print 'test2([1,2,3])', test2([1,2,3]) > print 'test2([1,2])', test2([1,2]) > print 'test2()', test2() > print 'test2()', test2() > > Calling test2

Re: [Tutor] Import module function using variable

2018-06-13 Thread Alan Gauld via Tutor
On 13/06/18 02:52, Slater, Joseph C. wrote: > I am trying to import a function in a module by variable name. I'd suggest getattr(): >>> import sys >>> xt = getattr(sys,exit) >>> xt() Alternatively, if its a fixed set of options (and it sound as if it is) set up a dictionary: funcs = {'exit':

Re: [Tutor] Iteration issues

2018-06-07 Thread Alan Gauld via Tutor
On 07/06/18 23:21, Roger Lea Scherer wrote: > they won't. I've started from scratch again. > > ** > import string > > gettysburg = > open("C:/Users/Roger/Documents/GitHub/LaunchCode/gettysburg.txt", "r") > > puncless = "" > for char in gettysburg: I think this is wrong. gettysburg is

Re: [Tutor] Turtle drawing

2018-06-05 Thread Alan Gauld via Tutor
On 05/06/18 21:46, Roger Lea Scherer wrote: > datums = open("C:/Users/Roger/Documents/GitHub/LaunchCode/mystery.txt", "r") > > for aline in datums: > splitted = aline.split() > try:... > except: > while splitted == "UP": > hadir.pu() splitted will never equal

Re: [Tutor] Question Regarding startswith()

2018-06-04 Thread Alan Gauld via Tutor
On 04/06/18 16:57, Jeremy Ogorzalek wrote: > Not sure this is how this is done, but here goes. > > When I try to run the code in the SGP4 module, I get the following error, > and it originates in the io.py script: I have no idea what you are talking about and do not know what the SGP4 or io.py

Re: [Tutor] guess my number game (reversed)

2018-06-01 Thread Alan Gauld via Tutor
On 01/06/18 14:00, chiara pascucci wrote: > the user's input. The programme works fine if the it guesses the number > right on its first try, but when the users inputs "too low" or "too high" > an infinite loop is returned. I thinkI have done something wrong in my > while loop and that my sentry

Re: [Tutor] (no subject)

2018-06-01 Thread Alan Gauld via Tutor
On 31/05/18 07:06, erich callahana wrote: > I’m not sure how to access this window > Unfortunately this is a text mailing list and the server strips binary attachments for security reasons. Either send us a link to a web page or describe what it is you are trying to do. Include the program

Re: [Tutor] i really need help

2018-05-30 Thread Alan Gauld via Tutor
On 30/05/18 11:09, erich callahana wrote: > I need to know how to access the window where > in the menu at the top it > says run You need to help us out here. What program are you running or trying to run that has this Window? It sounds like an IDE of some kind, maybe IDLE? But most IDEs have a

Re: [Tutor] Tkinter widget (label) updated by TCP/IP message

2018-05-28 Thread Alan Gauld via Tutor
On 28/05/18 19:56, Alejandro Chirife via Tutor wrote: > Two questions:  > 1. ...  How do you send an event of data arriving > when the events for tkinter are all about user interaction? The easiest way is to set a global variable and use a timer event (after()) to poll the variable periodically

Re: [Tutor] get key value from Redis instance

2018-05-27 Thread Alan Gauld via Tutor
On 27/05/18 19:31, Silviu Chiric wrote: > Dear all > > I need to get the value of given key from Redis, or both key and value, the > below code snippet fails always, even the connection is okay Please post the output. You print the error trace but we cant see it. Or if that is the the whole

Re: [Tutor] Storing passwords and version control

2018-05-27 Thread Alan Gauld via Tutor
On 27/05/18 17:21, Joel Goldstick wrote: > On Sun, May 27, 2018 at 12:08 PM, Pat Martin wrote: >> ... Since it will be a script I will be running >> through cron I won't be able to type the password > You can set environment variables on the system that runs the script. EV

Re: [Tutor] Tkinter widget (label) updated by TCP/IP message

2018-05-27 Thread Alan Gauld via Tutor
On 27/05/18 16:18, Alejandro Chirife via Tutor wrote: > > Hi all, I am having a hard time to create what at first looked like a simple > program with Python 3 and Tkinter: > The UI consist of a window with a label and a button.   > The label shows "waiting for a message" and the button shows

Re: [Tutor] Problem importing pandas library

2018-05-27 Thread Alan Gauld via Tutor
On 27/05/18 04:43, Bhavna Soni wrote: > I installed pandas library using pip9. I get errors while importing > it, Uninstalling and Re-installing won't help. It says DLL load failed > as window file is not found. The next time I import it says pandas > don't have core attribute, ut core folder is

Re: [Tutor] os.walk() with multiple paths

2018-05-22 Thread Alan Gauld via Tutor
On 22/05/18 20:06, Pi wrote: > works fine, but only for one path. And I need to use more than one path. > With one path given works great: > > >>> find_db("/dbbs") > ['april.db, /dbbs/analysis/april.db', 'important.sqlite, > /dbbs/temp/important.sqlite', 'march.db, /dbbs/analysis/march.db',

Re: [Tutor] help with Pandas

2018-05-22 Thread Alan Gauld via Tutor
On 22/05/18 18:13, Glenn Schultz wrote: Cavbeat: I'm no dataframe expert so I'm going on general principles here... > I am trying to apply the function to the data frame as follows: > > df['loanage'].apply(myfunction(x = 2, y = 10, z = 10, df['loanage]), axis = 0) This looks wrong on several

Re: [Tutor] Calling class from another class

2018-05-22 Thread Alan Gauld via Tutor
On 22/05/18 11:16, aishwarya selvaraj wrote: > I'm attaching both the files along with this email. It would be great if > someone could help me out here. Thanks in advance I don't see the attachments, even though they may just be text the server probably sees them as potentially executable and

Re: [Tutor] redirecting testing output to file, using two different options

2018-05-16 Thread Alan Gauld via Tutor
On 16/05/18 09:53, Yosef Levy wrote: > Hello All, > > I have testing environment. > Code is written under Python 2.6. > testing output should be redirected to log file. You don't say which OS you are using but if it's a Unix variant you could just use command line redirection of stdout/stderr.

Re: [Tutor] Python Question

2018-05-16 Thread Alan Gauld via Tutor
On 15/05/18 22:26, Mahamed Ahmed wrote: > Please I would like you to help me solve the problem above We see no problem. this is a text only list so if you included a binary attachment the server will have stripped it off for security reasons. Please repost the text of the problem description

Re: [Tutor] Help

2018-05-16 Thread Alan Gauld via Tutor
On 16/05/18 02:43, Steven D'Aprano wrote: > The traceback Sam posted says (in part): > > Move = input('What Will You Do? Fight or Run: ') > File "", line 1, in > NameError: name 'Run' is not defined > > so the failed line was the call to input(). In Python 3, it would return > a string.

Re: [Tutor] Question about a python finction

2018-05-12 Thread Alan Gauld via Tutor
On 12/05/18 06:40, peter wrote: > range does not work the same for 2.7 and my 3.6.5. Seems they have > changed the nature of range. It is a built in listed along with lists > and tuples You are correct in that it has changed slightly and now returns a range object. but you can convert it to a

Re: [Tutor] ImportError: No module named openpyxl.workbook

2018-05-11 Thread Alan Gauld via Tutor
On 11/05/18 01:43, Pareshkumar Panchal wrote: > Error: > from openpyxl.workbook import Workbook > ImportError: No module named openpyxl.workbook > > I am using only pandas however it still works fine on one computer having > openpyxl already installed eventhough i am not using openpyxl in the >

Re: [Tutor] How to maximize a window in tkinter

2018-05-10 Thread Alan Gauld via Tutor
On 10 May 2018, at 16:52, emanuel sandoval wrote: >I want to know how to maximize a window in tkinter. There are several options, of which your solution is probably the best! The others involve setting the window position to top left and the width and height

Re: [Tutor] Choice of tools

2018-05-09 Thread Alan Gauld via Tutor
On 9 May 2018, at 23:54, Brad M wrote: > >As an aside, I can't get "Error squiggles" to show up in my .c project in >visual studio 2017, where as in my .cpp project it promptly notifies me I don't know visual studio so this is a guess. But remember that c and c++ are

Re: [Tutor] Append to list

2018-05-09 Thread Alan Gauld via Tutor
On 9 May 2018, at 23:57, Rick Jaramillo wrote: > >Hello, >I’m having trouble understanding the following behavior and would greatly >appreciate any insight. >l = [1,2,3,4] >b=[] >for i in range(l): >    print l >    b.append(l) >    l.pop(0) >print b >OUTPUT >[1,2,3,4]

Re: [Tutor] guess my number game

2018-05-09 Thread Alan Gauld via Tutor
ou put it in a file. If you try typing it at the python prompt you may well get the result you describe. Alan g. On Tue, May 8, 2018 at 6:18 PM, Alan Gauld <[1]alan.ga...@yahoo.co.uk> wrote: The first block of code is full of errors and couldn't work so I have no idea w

Re: [Tutor] guess my number game

2018-05-08 Thread Alan Gauld via Tutor
The first block of code is full of errors and couldn't work so I have no idea what you were really doing! The second block should kind of work. From your description I'd guess you have an indentation error such that most of the code that should be inside the loop is being bypassed. Are you

Re: [Tutor] How to separate UI code from program logic?

2018-05-08 Thread Alan Gauld via Tutor
Bob, On 8 May 2018, at 19:56, boB Stepp < >Judging from the lack of responses, I guess I must have been on track >on the other questions. On The basics yes. There were a few picky details I would normally have mentioned but I'm on vacation and replying inline via gmail on my tablet is just too

Re: [Tutor] calling printf() in a C language DLL using ctypes.CDLL

2018-05-08 Thread Alan Gauld via Tutor
I'm guessing at the answer here because I'm on vacation with no access to a pc of any kind let alone Windows. But are you running python inside an ide? If so you might find you get the expected result if you use a command prompt, since printf usually sends output to stdout. This is another

Re: [Tutor] use python to log to a remote supercomputer and transfer files

2018-05-07 Thread Alan Gauld via Tutor
On 7 May 2018, at 15:08, ruiyan wrote: > I want to log to the remote supercomputer automatically, upload and download > files If it supports ftp then there is an ftp module. There are also http and ssh modules, depending on the complexity of your needs and

Re: [Tutor] PMML vs. Pickel

2018-05-07 Thread Alan Gauld via Tutor
The tutor list is for those learning python and its standard library. I suspect you will get a better response asking on the main python list. Alan g. ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

Re: [Tutor] How to separate UI code from program logic?

2018-05-06 Thread Alan Gauld via Tutor
On 6 May 2018, at 23:00, boB Stepp wrote: >I was solving a programming problem in one of my books concerning the >generation of a Collatz sequence >(https://en.wikipedia.org/wiki/Collatz_conjecture), and started to >wonder how I should separate my program's output from

Re: [Tutor] Matplotlib scatterplot help

2018-04-30 Thread Alan Gauld via Tutor
On 30/04/18 16:57, Daniel Bosah wrote: > I have a function in which returns scatterplot of a Isomap Below you show a function that creates a scatterplot but it does not return anything. Sorry to nitpick but correct terminology is quite important in understanding what you are trying to achieve. >

Re: [Tutor] updating stock list

2018-04-30 Thread Alan Gauld via Tutor
On 30/04/18 23:15, Shannon Evans via Tutor wrote: > Hi, i'm wanting to update the stock list at the end so that the fruit > that's given is taken subtracted from the original stock list. The code > i've written isn't updating it it's just staying the same. Any idea what i > can do to fix this? >

Re: [Tutor] Help with loops

2018-04-30 Thread Alan Gauld via Tutor
On 30/04/18 14:35, Shannon Evans via Tutor wrote: > Hi, is there any way that i can add a loop or iteration or something so > that i dont have to write out every person who has fruit. Yes that's what loops are for. You have two options in Python: a 'for' loop or a 'while' loop In your case I

Re: [Tutor] Dict of Dict with lists

2018-04-26 Thread Alan Gauld via Tutor
On 26/04/18 14:48, Mats Wichmann wrote: >>> However personally I'd use a class to define your data structure and >>> just have a top level dictionary holding instances of the class. >> >> You are right (again). I haven't thougt of using classes, but that's exactly >> what they were invented for.

Re: [Tutor] Dict of Dict with lists

2018-04-25 Thread Alan Gauld via Tutor
On 25/04/18 14:22, Kai Bojens wrote: > The structure I'd like to have: > > result = { > 'f...@bar.de': { > 'Countries': [DE,DK,UK] > 'IP': ['192.168.1.1','172.10.10.10'] > 'Count': [12] > } > } > ... > for line in logfile: >

Re: [Tutor] threading for each line in a large file, and doing it right

2018-04-25 Thread Alan Gauld via Tutor
On 25/04/18 09:27, Alan Gauld via Tutor wrote: >> for i in $(< massive_input.file); do >> time_intensive_stuff_in_bash i & disown >> : >> done > > Its the same except in bash you start a whole > new process so instead of using thre

Re: [Tutor] threading for each line in a large file, and doing it right

2018-04-25 Thread Alan Gauld via Tutor
On 25/04/18 03:26, Evuraan wrote: > Please consider this situation : > Each line in "massive_input.txt" need to be churned by the > "time_intensive_stuff" function, so I am trying to background it. What kind of "churning" is involved? If its compute intensive threading may not be the right

Re: [Tutor] Python 3.6.5 for MAC

2018-04-24 Thread Alan Gauld via Tutor
On 24/04/18 03:34, Kentaro Hori wrote: > Hi > > can you take a screenshot after rebooting and trying one aging? Although you will need to post a link to the image since the list server will not send binary attachments. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/

Re: [Tutor] Theory of computation non-emptiness

2018-04-21 Thread Alan Gauld via Tutor
On 21/04/18 12:50, tracey jones-Francis wrote: > Hi there, I've been working on code I've only glanced at this but one thing jumped out at me: > while queue: > currentState = queue.pop(0) > visited.append(currentState) > #print(visited) > for a in newAplhabet: > if (currentState, a) ==

Re: [Tutor] File handling Tab separated files

2018-04-20 Thread Alan Gauld via Tutor
Use Reply-All or Reply-List to include the mailing list in replies. On 20/04/18 09:10, Niharika Jakhar wrote: > Hi > > I want to store the data of file into a data structure which has 11 > objects per line , something like this: > 2354   somethin2 23nothing       23214. > > > so I

Re: [Tutor] anomaly

2018-04-20 Thread Alan Gauld via Tutor
On 20/04/18 05:53, D.V.N.Sarma డి.వి.ఎన్.శర్మ wrote: > I have a situation in which the same code gives an error in idle but works > in qtconsole > regards, > > *​in idle* > v = np.zeros(len(x)) > > for i in range(len(x)): > if x[i] < 1.0: > v[i] = 0 You don't give us any clue to

Re: [Tutor] File handling Tab separated files

2018-04-19 Thread Alan Gauld via Tutor
On 19/04/18 17:50, Niharika Jakhar wrote: > Hi again > I tried re-writing the code with all your advices(i assume to cover all of > them). I have extended the code a little bit to store the data in the form > of lists and am trying to access it. > I also changed the file name to BioGRID.txt > >

Re: [Tutor] Need help please

2018-04-16 Thread Alan Gauld via Tutor
On 16/04/18 03:30, Sandra Sherif via Tutor wrote: > Dear Python Tutor, > > I am in desperate need for help with programming on python. I am new to using > python and I’m trying to write a program called “turtle tag”. I’m trying to > do these things in the program: > a. Asks how many turtles

Re: [Tutor] tkinter code executes before function returned

2018-04-15 Thread Alan Gauld via Tutor
On 15/04/18 14:24, Alan Gauld via Tutor wrote: > OK, I've had a closet look now and can confirm the A closer look! Not a closet look. Ooops! :-/ -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Fli

Re: [Tutor] tkinter code executes before function returned

2018-04-15 Thread Alan Gauld via Tutor
On 15/04/18 03:57, Chris Roy-Smith wrote: > The code does not wait till the function returns a value, OK, I've had a closet look now and can confirm the problem lies in your code structure. Its not event based. You need to understand event-driven programming better. In event driven code you

Re: [Tutor] tkinter code executes before function returned

2018-04-15 Thread Alan Gauld via Tutor
On 15/04/18 03:57, Chris Roy-Smith wrote: > I am trying to get tkinter to return a number from a window, which then > sets how many times to print a sign. I don;t jhave time to look at this in detail just now, maybe later. But first impressions is that you have a very unorthodox style of

Re: [Tutor] csv merge with different column title

2018-04-14 Thread Alan Gauld via Tutor
On 14/04/18 04:32, Pareshkumar Panchal wrote: > I am trying to merge two csv files with following condition. > > filea.csv column( a1,a2,a3) > fileb.csv column( b1,b2,b3) > > i wanted to merge if a1 & b1 reference (as the title is different but > contents are valid for comparison). also the

Re: [Tutor] PLEASE HELP

2018-04-12 Thread Alan Gauld via Tutor
On 12/04/18 18:24, Scharrer, Brianna wrote: What appears below seems to be an assignment of some kind. We do not do your work for you although we will offer help. But it is best if you show us your work so far, or at least describe how you intend to tackle it. In this case you are being given a

Re: [Tutor] Json files

2018-04-12 Thread Alan Gauld via Tutor
On 12/04/18 17:44, Shannon Evans via Tutor wrote: > Hi, > I have managed to get my two json files that need to be imported into > python and then i need to write a program on who gets fruit and who doesn't > and then need to get the final stock at the end. I was just wondering how i > import the

Re: [Tutor] Help with a task

2018-04-12 Thread Alan Gauld via Tutor
On 12/04/18 11:54, Aditya Mukherjee wrote: > Hello, I'm relatively new to python and have been given a task for > university, and would greatly appreciate if anyone could help me basically > just get started because as of now I am completely clueless and have no > idea what to do. I don't really

Re: [Tutor] Problem regarding NZEC error

2018-04-08 Thread Alan Gauld via Tutor
On 08/04/18 06:16, SUNIL KUMAR MAURYA wrote: > NZEC error occurs often in Python 3.5. How can it be resolved? A Non Zero Error Code occurs when the interpreter exits with an error. Those are very rarely errors in the interpreter they are due to errors in the code which it is executing. So, to

Re: [Tutor] Return problems

2018-04-07 Thread Alan Gauld via Tutor
On 07/04/18 01:50, Roger Lea Scherer wrote: > So I've examined my educational material, I've perused the python > documentation and for the life of me I can't figure out why return doesn't > print a result in the IDE. I use print, the program acts as expected. What > am I missing? The fact that

Re: [Tutor] Using the Nimblenet Library in Python 3.6

2018-04-05 Thread Alan Gauld via Tutor
On 05/04/18 15:28, Zachary Ware wrote: > I would appreciate keeping the FUD about the differences to a minimum > :). The differences are there and they are significant, but far from > insurmountable; in my experience, well-written Python 3 code is fairly > trivial to port to Python 2/3. I

Re: [Tutor] Using the Nimblenet Library in Python 3.6

2018-04-05 Thread Alan Gauld via Tutor
On 05/04/18 04:02, Mark Lawrence wrote: > Python 3.6 has more functionality than 2.7 by definition, but your > comment implies, at least to me, that 2.7 and 3.6 are chalk and cheese. > Nothing could be further from the truth and has regrettably been one of > the reasons for the dreadfully slow

Re: [Tutor] Using the Nimblenet Library in Python 3.6

2018-04-04 Thread Alan Gauld via Tutor
On 04/04/18 16:10, Evapcoop, Evapcoop wrote: > I wanted to know if it is possible to use Nimblenet and all it's > associated packages with Python3.6.> From what I have read, that library is > compatible with Python2.7. I think you just answered your own question. If the package is designed for

Re: [Tutor] import tkinter as tk

2018-04-03 Thread Alan Gauld via Tutor
On 03/04/18 02:15, Rex via Tutor wrote: > At the Python command prompt, I write: > > import tkinter as tk > top = Tk() You forgot the module prefix. top = tk.Tk() -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my

Re: [Tutor] Python help

2018-04-02 Thread Alan Gauld via Tutor
On 03/04/18 01:19, Steven D'Aprano wrote: > >> if Grade not in 'A','B','C','D','E','F': > Actually, that returns a tuple consisting of a flag plus five more > strings: > > py> 'A' in 'A','B','C', 'D', 'E', 'F' > (True, 'B','C', 'D', 'E', 'F') Although in the context of the program the colon

Re: [Tutor] Python help

2018-04-02 Thread Alan Gauld via Tutor
On 03/04/18 01:19, Steven D'Aprano wrote: > On Tue, Apr 03, 2018 at 01:00:59AM +0100, Alan Gauld via Tutor wrote: > >> You need to use 'in' instead. That will check whether >> or not Grade is *one* of the values in the tuple. >> >> if Grade not in 'A','

Re: [Tutor] Python help

2018-04-02 Thread Alan Gauld via Tutor
On 02/04/18 23:44, Shannon Evans via Tutor wrote: > Hi, I am trying to write a code with if statements but the code keeps just > repeating and not carrying on. There are quite a few problems here, see comments below. > while True: > try: > Grade = int(raw_input("Please enter your

Re: [Tutor] pythonic

2018-04-02 Thread Alan Gauld via Tutor
On 02/04/18 04:19, Steven D'Aprano wrote: > On Sun, Apr 01, 2018 at 10:58:51PM +0100, Alan Gauld via Tutor wrote: >> On01/04/18 20:20, Albert-Jan Roskam wrote: >>> fmt="%Y-%m-%d %H:%M\n" >>> f.write(now.strftime(fmt)) >>> Lately I've been using f

Re: [Tutor] running a .py file from the comand line

2018-04-02 Thread Alan Gauld via Tutor
On 02/04/18 01:46, Rex Florian via Tutor wrote: > Hello, > > I am running Python 3.6 in a Window 7 environment. > I have a python script > that I am trying to run from the command line. > I have copied it to a file named Ascii Keys.py into my user directory > c:\Users\Rex > > I try to execute

Re: [Tutor] pythonic

2018-04-01 Thread Alan Gauld via Tutor
On01/04/18 20:20, Albert-Jan Roskam wrote: > fmt="%Y-%m-%d %H:%M\n" > f.write(now.strftime(fmt)) > Lately I've been using format(), which uses __format__, because I find it > slightly more readable: > format(datetime.now(), "%Y-%m-%d %H:%M") Interesting, I didn't know that format() recognised the

Re: [Tutor] creating a connection class

2018-03-30 Thread Alan Gauld via Tutor
On 30/03/18 15:55, Glenn Schultz wrote: > I can create a connection as follows and it works Well done, so you get a connection object back as a result. > but I think it is best to have a connection class that opens and closes.   Why? You already have a connection object. Classes are created

Re: [Tutor] pythonic

2018-03-30 Thread Alan Gauld via Tutor
On 30/03/18 03:48, Pat Martin wrote: > the "right" way to do it in python? More or less, a couple of comments below... > def Main(): Python function names begin with a lowercase letter by convention. > """Run if run as a program.""" > parser = argparse.ArgumentParser() ... > >

Re: [Tutor] Sentiment analysis read from a file

2018-03-28 Thread Alan Gauld via Tutor
On 28/03/18 18:14, Peter Otten wrote: >> Just a quick response, but your data is more than a text file its a CSV next(open("training.txt")) > '1\tThe Da Vinci Code book is just awesome.\n' > > So the delimiter would be TAB: Ah! On my screen it looked like a space... > The CSV module prefers

Re: [Tutor] Sentiment analysis read from a file

2018-03-28 Thread Alan Gauld via Tutor
On 28/03/18 11:07, theano orf wrote: > I am new in python and I am having problems of how to read a txt file and > insert the data in a list, Just a quick response, but your data is more than a text file its a CSV file so the rules change slightly. Especially since you are using the csv module.

Re: [Tutor] Polygon fill in turtle

2018-03-27 Thread Alan Gauld via Tutor
On 27/03/18 22:10, Roger Lea Scherer wrote: > outlineColor = input("What color would you like for the outline?") > filler = input("And what color would you like to fill it with? ") > > hadir.begin_fill() > hadir.color(outlineColor) > print(filler) > for i in range(sides): >

Re: [Tutor] Tutor Digest, Vol 169, Issue 20

2018-03-26 Thread Alan Gauld via Tutor
First of all, please do not repost the entire digest - we have all already seen them - and some people pay by the byte. Secondly... On 26/03/18 21:44, David Brown wrote: > Thanks Joel. That got me going in the right direction. I ended up using a > "while true" statement. The code below seems to

Re: [Tutor] Tutor Digest, Vol 169, Issue 17

2018-03-23 Thread Alan Gauld via Tutor
First, please don't repost the entire digest - we've all seen the messages before and some people pay by the byte. Secondly it makes finding the relevant message pertaining to your question much harder to find. Delete all the irrelevant stuff. The other problem with the digest is that it tends

<    1   2   3   4   5   6   7   8   9   10   >