Re: [Tutor] Learning Objectives?

2017-02-27 Thread Mats Wichmann
On 02/27/2017 07:57 AM, leam hall wrote: > When I was coming up as a Linux guy I took the old SAGE guidelines and > studied each "level" in turn. It was useful for making me a well-rounded > admin and helped me put off some higher end stuff I wasn't really ready > for. > > Things like Testing

Re: [Tutor] Help with function scoping

2017-03-23 Thread Mats Wichmann
On 03/22/2017 03:17 PM, Richard Mcewan wrote: > Hi > > I wonder if you can help. > > I'm confused about how functions should work. Below is some code I write to > check my understanding. > > I'm expecting two functions to be defined. Then called. One returns a random > number. The other

Re: [Tutor] Using Class Properly - early beginner question

2017-03-23 Thread Mats Wichmann
On 03/22/2017 06:30 AM, Rafael Knuth wrote: > thanks for your feedback! @boB > > I wrote a function that does exactly what I want, and that is: > Create a shopping list and then let the user decide which items (food) > are supposed to be instantly consumed and which ones stored. > > def

Re: [Tutor] super constructor usage

2017-03-30 Thread Mats Wichmann
On 03/29/2017 08:33 AM, Rafael Knuth wrote: > class A: > def __init__(self, message): > self.message = message > print(message) > > I then modified the child class B like this: > > class B(A): > def __init__(self, message): > print("This is the message from your

Re: [Tutor] super constructor usage

2017-03-30 Thread Mats Wichmann
On 03/29/2017 04:02 PM, Mats Wichmann wrote: > On 03/29/2017 08:33 AM, Rafael Knuth wrote: > >> class A: >> def __init__(self, message): >> self.message = message >> print(message) >> >> I then modified the child class B like this:

Re: [Tutor] super constructor usage

2017-03-31 Thread Mats Wichmann
On 03/30/2017 05:39 AM, Rafael Knuth wrote: I am trying to wrap my head around the super constructor. > > Is it possible to embed a super constructor into an if / elif > statement within the child class? > > if message == "string A": return X > elif: return Y > > How should I modify my

Re: [Tutor] reading files in Python 3

2017-03-31 Thread Mats Wichmann
On 03/30/2017 11:02 AM, Rafael Knuth wrote: > I can read files like this (relative path): > > with open("Testfile_B.txt") as file_object: > contents = file_object.read() > print(contents) > > But how do I read files if I want to specify the location (absolute path): > > file_path =

Re: [Tutor] Using an XML file for web crawling

2017-03-31 Thread Mats Wichmann
On 03/31/2017 05:23 AM, Igor Alexandre wrote: > Hi! > I'm a newbie in the Python/Web crawling world. I've been trying to find an > answer to the following question since last week, but I couldn't so far, so I > decided to ask it myself here: I have a sitemap in XML and I want to use it > to

Re: [Tutor] reading files in Python 3

2017-03-31 Thread Mats Wichmann
On 03/31/2017 09:44 AM, Alex Kleider wrote: > On 2017-03-30 13:45, Mats Wichmann wrote: > >> >> Yeah, fun. You need to escape the \ that the idiot MS-DOS people chose >> for the file path separator. > > I also believe that the "MS-DOS people" are making

Re: [Tutor] downloading modules for both python 2 and 3

2017-04-09 Thread Mats Wichmann
On 04/09/2017 02:20 AM, Peter Otten wrote: > Benjamin Fishbein wrote: > >> I’ve been writing an app using Kivy, and now I want to test it out on an >> iPhone. However, this can currently only be done in Python 2. >> https://kivy.org/docs/guide/packaging-ios.html >>

Re: [Tutor] (no subject)

2017-04-09 Thread Mats Wichmann
On 04/09/2017 04:42 AM, shubham goyal wrote: > Hello, I am a c++ programmer and wants to learn python for internship > purposes. How can i learn the advanced python fast mostly data science > packages, I know basic python. Try an internet search? Don't mean to be snide, but there are lots of

Re: [Tutor] What would be good use cases for the enum module?

2017-04-09 Thread Mats Wichmann
On 04/09/2017 01:54 AM, Alan Gauld via Tutor wrote: > On 09/04/17 04:00, boB Stepp wrote: > >> understandable to me, but I am having difficulty imagining where I >> might want to use these features. >> > > Steven has given the basics, here are a few more real world examples: > > Any kind of

Re: [Tutor] counting function calls

2017-04-10 Thread Mats Wichmann
On 04/10/2017 01:55 AM, marcus lütolf wrote: > Dear experts, > I have written the following code for motion detection with a PIR sensor > with a function and > I need to count how many times the funtion is called, but I get a traceback: > > #!/usr/bin/python3 > import sys, time > import RPi.GPIO

Re: [Tutor] Count for loops

2017-04-11 Thread Mats Wichmann
On 04/11/2017 10:48 AM, Rafael Knuth wrote: > Thanks for the clarification. > I tested this approach, and I noticed one weird thing: > > Pi_Number = str(3.14159265358979323846264338327950288419716939) > Pi_Number = "3" + Pi_Number[2:] > print(Pi_Number) > > == RESTART:

Re: [Tutor] Asking about Run python script at Startup

2017-04-03 Thread Mats Wichmann
On 04/03/2017 04:20 AM, Alan Gauld via Tutor wrote: > On 03/04/17 05:34, Quang nguyen wrote: > >> I do not know how to run my python 3 script after my PI2 finished startup. > > This might be a better question for a PI forum since it doesn't > seem to have anything directly to do with Python. >

Re: [Tutor] Validating String contains IP address

2017-04-01 Thread Mats Wichmann
On 03/31/2017 06:44 PM, Alex Kleider wrote: > On 2017-03-31 16:35, Ed Manning wrote: >> What's the best way to validate a string contains a IP address >> Sent from my iPad >> ___ >> Tutor maillist - Tutor@python.org >> To unsubscribe or change

Re: [Tutor] Question about loop and assigning variables

2017-04-06 Thread Mats Wichmann
On 04/05/2017 01:07 PM, Fazal Khan wrote: > Hello, > > Heres another newbie python question: How can I loop through some data and > assign different variables with each loop > > So this is my original code: > > def BeamInfo(x): > for Bnum in x: > if

Re: [Tutor] [PYTHON27] How to save into .npy file?

2017-04-11 Thread Mats Wichmann
On 04/10/2017 07:17 PM, Steven D'Aprano wrote: > On Mon, Apr 10, 2017 at 02:10:34PM +, Allan Tanaka via Tutor wrote: >> Hi. >> Is there a way to save module type data into .npy file that can be used >> latter? > > What's "module type data"? > > What's a .npy file? > > To answer your

Re: [Tutor] Can a virtual environment be renamed?

2017-04-16 Thread Mats Wichmann
On 04/16/2017 10:16 AM, Jim wrote: > On 04/16/2017 10:10 AM, Chris Warrick wrote: >> On 16 April 2017 at 16:45, Jim wrote: >>> My system python is 2.7.12 so I created a virtual environment using >>> venu to >>> run 3.5.2. I put it in /home/jfb/EVs/env. Now I would like to

Re: [Tutor] Do not understand code snippet from "26.8. test — Regression tests package for Python"

2017-04-17 Thread Mats Wichmann
On 04/16/2017 10:01 PM, boB Stepp wrote: > OK, between Alan and Martin I think that I see how to make the code > snippet actually test a *function* as the snippet seems to suggest. > Recollect that my original question(s) started: You got me thinking as well, as I don't much care for unittest,

Re: [Tutor] using sudo pip install

2017-04-20 Thread Mats Wichmann
On 04/20/2017 01:24 PM, bruce wrote: > Hey guys.. > > Wanted to get thoughts? > > On an IRC chat.. someone stated emphatically... > > Never do a "sudo pip install --upgrade..." > > The claim was that it could cause issues, enought to seriously > (possibly) damage the OS.. > > So, is this

Re: [Tutor] understanding code testing

2017-04-16 Thread Mats Wichmann
On 04/15/2017 08:33 AM, Rafael Knuth wrote: > can anyone point me to good learning resources on this subject? > (python 3) > ___ > Tutor maillist - Tutor@python.org > To unsubscribe or change subscription options: >

Re: [Tutor] classproperty for Python 2.7 (read-only enough)

2017-04-18 Thread Mats Wichmann
On 04/18/2017 04:00 AM, Thomas Güttler wrote: > I would like to have read-only class properties in Python. > > I found this > http://stackoverflow.com/questions/128573/using-property-on-classmethods > But there are a lot of discussions of things which I don't understand. > > I want to be a user

Re: [Tutor] Help!! Code ridden with Bugs

2017-03-09 Thread Mats Wichmann
On 03/09/2017 12:32 PM, Joel Goldstick wrote: > On Thu, Mar 9, 2017 at 8:28 AM, Eloka Chima via Tutor > wrote: >> I am new to programming but an immersive study in the past few weeks have >> brought me to speed so I can play around with codes but not really mastered >>

Re: [Tutor] printing items form list

2017-03-03 Thread Mats Wichmann
On 03/03/2017 05:12 AM, Rafael Knuth wrote: > I want to print individual items from a list like this: > > You have a book, towel, shirt, pants in your luggage. > > This is my code: > > suitcase = ["book", "towel", "shirt", "pants"] > print ("You have a %s in your luggage." % suitcase) > >

Re: [Tutor] looping - beginner question

2017-03-02 Thread Mats Wichmann
On 03/02/2017 08:06 AM, Alan Gauld via Tutor wrote: > On 02/03/17 13:42, Rafael Knuth wrote: > >> bar = ["beer", "coke", "wine"] >> >> customer_order = input("What would you like to drink, dear guest? ") >> >> for drink in bar: >> if customer_order != drink: >> print ("Sorry, we don't

Re: [Tutor] Lists of duplicates

2017-03-09 Thread Mats Wichmann
On 03/08/2017 12:56 PM, Sri Kavi wrote: > As part of my learning, I was participating in a discussion at: > > > > https://discuss.codecademy.com/t/python-lists-of-duplicated-elements/78151 > > > > It’s about making a function that returns a list of lists, with each list > being all of the

Re: [Tutor] While until the end of a list

2017-03-13 Thread Mats Wichmann
On 03/13/2017 10:48 AM, Toni Fuente via Tutor wrote: > * David Rock [2017-03-13 11:28:57 -0500]: >> You just need to make a list or a dict to store the information for each >> site, and add the results to it. If you use a list, it would be >> list.append(), for example.

Re: [Tutor] Is this a scope issue?

2017-03-06 Thread Mats Wichmann
On 03/05/2017 06:33 PM, Rafael Skovron wrote: > This project compares two text files with parcel numbers. I think I'm > messing up the function call. I'm getting this error: > > Traceback (most recent call last): > File "amador.py", line 48, in > remaining_parcels(auctionlist,removedlist)

Re: [Tutor] Socket error in class

2017-03-06 Thread Mats Wichmann
On 03/06/2017 10:35 AM, leam hall wrote: > What am I missing? > > > class mysocket(): > import socket > def __init__(self, sock=None); > if sock is None: > self.sock = socket.socket(socket.socket.AF_NET, > socket.socket.SOCK_STREAM) > else: > self.sock = sock > > >

Re: [Tutor] Count for loops

2017-04-03 Thread Mats Wichmann
On 04/03/2017 10:16 AM, Alan Gauld via Tutor wrote: > On 03/04/17 16:42, D.V.N.Sarma డి.వి.ఎన్.శర్మ wrote: >> Sorry. That was stupid of me. The loop does nothing. > > Let me rewrite the code with some different variable names... > with open(file_path) as a: b = a.read() > > with

Re: [Tutor] reg. list update

2017-04-17 Thread Mats Wichmann
>> >> Is there anything wrong in this code or any feature of python? > > yeah, feature of Python. you could google for "deep copy". > the reference issue is involved here, but my explanation was off, I confused myself, listen to Peter instead :) It's just the same list four times.

Re: [Tutor] reg. list update

2017-04-17 Thread Mats Wichmann
On 04/17/2017 12:41 PM, Rasika Sapate via Tutor wrote: > Dear Python group, > I had written following code. > > super = [] > sub = [""]*3 > other = ["a","b","c","d"] > sub[0] = "hi" > sub[1] = "hello" > for item in other: > sub[2] = item > super.append(sub) > for item in super: >

Re: [Tutor] Visual Studio Community 2017

2017-04-18 Thread Mats Wichmann
On 04/18/2017 11:14 AM, Alan Gauld via Tutor wrote: > On 18/04/17 17:55, Rafael Knuth wrote: >> I wanted to start my first project using matplotlib (I have never >> worked with libraries before). > > Every time you do an import you are using a library. > eg > > import sys > import os > etc > >

Re: [Tutor] Visual Studio Community 2017

2017-04-18 Thread Mats Wichmann
... naturally, far better than what I wrote, is: https://docs.microsoft.com/en-us/visualstudio/python/python-environments ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options:

Re: [Tutor] pythonic ascii decoding!

2017-07-31 Thread Mats Wichmann
On 07/31/2017 09:39 AM, bruce wrote: > Hi guys. > > Testing getting data from a number of different US based/targeted > websites. So the input data source for the most part, will be "ascii". > I'm getting a few "weird" chars every now and then asn as fas as I can > tell, they should be utf-8. >

Re: [Tutor] If tuple cannot be sorted, then why sorted() on a tuple is fine?

2017-08-02 Thread Mats Wichmann
it generated a new object, did not change the original. hint: notice the output is a list, not a tuple! On August 2, 2017 1:01:31 PM MDT, C W wrote: >Dear list, > >I am a little confused about why Tuple can be sorted. > >Suppose I have the following, > >> aTuple = (9, 3, 7,

Re: [Tutor] What is meaning of "/" in "pow(x, y, z=None, /)"?

2017-08-02 Thread Mats Wichmann
On 08/01/2017 07:14 PM, Ben Finney wrote: > boB Stepp writes: > >> A quick scan of some of my Python books does not turn up the use of >> "/" as a function argument. > > The appearance of this in Python's documentation and dfunction signature > descriptions, without a

Re: [Tutor] The results of your email commands

2017-08-03 Thread Mats Wichmann
On 08/03/2017 10:21 AM, Alan Gauld via Tutor wrote: > On 03/08/17 11:05, Abdur-Rahmaan Janhangeer wrote: >> me i cooked up :... > > Yes that works too, especially if you don;t need access > to the individual prices later. > > There are a couple of things to make it more Pythonic... > >> x =

Re: [Tutor] file move with wait period

2017-08-03 Thread Mats Wichmann
On 08/03/2017 05:22 AM, banda gunda wrote: > Dear tutors, > > I am interested to move a set of files, periodically, from source_folder to > dest_folder. > source_folder receives processed files from a ‘decompressing program’. The > files are deposited from the ‘decompressing program’ at

Re: [Tutor] Percentage of installations without setuptools (Was if __name__=='__main__' ...)

2017-08-11 Thread Mats Wichmann
On 08/11/2017 09:54 AM, Alan Gauld via Tutor wrote: > On 11/08/17 13:35, Thomas Güttler wrote: > >> I guess most python installations have setuptools. > > I guess so too, although I don't know. > Those that don't are probably in one of two categories > a) people who just downloaded Python and

Re: [Tutor] Fwd: Re: "Path tree"

2017-08-14 Thread Mats Wichmann
On 08/14/2017 03:06 PM, Alan Gauld via Tutor wrote: > > Forwarding to the list. > > Forwarded Message > > > > > pic > http://imgur.com/a/CwA2G > > On Mon, Aug 14, 2017 at 8:55 AM, Alan Gauld via Tutor > wrote: > > On

Re: [Tutor] What exactly does the three dots do? Why such as thing?

2017-08-11 Thread Mats Wichmann
On 08/10/2017 05:23 PM, Alan Gauld via Tutor wrote: > On 10/08/17 14:39, C W wrote: > >> I suppose it's just a place holder, though I don't know when I would use it >> in my every day life. > > Probably never. > > Like most programming languages Python has a load of rarely used, > obscure

Re: [Tutor] "Path tree"

2017-08-14 Thread Mats Wichmann
On 08/13/2017 02:07 PM, Michael C wrote: > Hi all: > > I am trying to formulate a "path-finding" function, and I am stuck on this > problem: > > Please look at the picture attached: Those dots are coordinates of (x,y), > and this tree can be thought of as a list of tuples, with each tuple >

Re: [Tutor] conditional renaming folder and files in the tree

2017-08-14 Thread Mats Wichmann
On 08/14/2017 09:18 AM, banda gunda wrote: > Dear Tutor, > > > I have made some progress! > > But not yet got the results. > > Attached is revised code. > > > Specifically, the problem in below: > > > for root, dirs, files in os.walk(".", topdown=False): > for name in files: >

Re: [Tutor] Image i/o in python

2017-07-16 Thread Mats Wichmann
On 07/16/2017 10:13 AM, D.V.N.Sarma డి.వి.ఎన్.శర్మ wrote: > In python we have a set of imread and imshow in skimage. In matplotlib.image > we again have imreadand imshow functions. In scipy.misc we again have > another set imread and imshow. Are there anyfunctional differences between > these

Re: [Tutor] Which DB use with standalone desktop app

2017-07-06 Thread Mats Wichmann
On 07/06/2017 11:25 AM, Zachary Ware wrote: > On Thu, Jul 6, 2017 at 3:57 AM, Freedom Peacemaker > wrote: >> Hi Tutors, >> I am working on standalone desktop app with tkinter GUI (Python3), and i >> dont know which database should i use. I've tried to find solution on my >>

Re: [Tutor] @property vs @classmethod

2017-07-08 Thread Mats Wichmann
On 07/08/2017 06:56 PM, Steven D'Aprano wrote: > The pythonic way is not to use them at all. > > For experts only: you'll know when you need them. > > They really aren't even a little bit similar, if you thought they did > that just means that you haven't understood what they do. > > property

Re: [Tutor] Python Questions

2017-07-18 Thread Mats Wichmann
On 07/18/2017 11:42 AM, Alan Gauld via Tutor wrote: > On 18/07/17 11:41, Max Smith wrote: > >> What's the easiest way to learn python currently > > Write a lot of code. > > As to which tutorial to follow, that's a very personal choice and > depends on your previous knowledge and learning

Re: [Tutor] if/else statement

2017-07-18 Thread Mats Wichmann
And one more, the 'if' needs a colon at the end On July 18, 2017 5:10:30 PM MDT, Alan Gauld via Tutor wrote: >On 18/07/17 18:31, Shane Johnson (shanejoh) wrote: > >> def greater_less_equal_5(answer): >>if answer is '>' 5 >>return 1 >>elif answer is < 5:

Re: [Tutor] unitest with random inputs

2017-07-19 Thread Mats Wichmann
On 07/19/2017 10:55 AM, Sydney Shall wrote: > On 19/07/2017 18:42, Steven D'Aprano wrote: >> On Wed, Jul 19, 2017 at 05:01:53PM +0200, Sydney Shall wrote: >> >> [...] >>> def test_zero_in_capitalsadvanced(self): >>> self.assertIn(self.capitalsadvanced, 0.0) >>> >>> The error message is:

Re: [Tutor] new to python

2017-07-23 Thread Mats Wichmann
On 07/23/2017 09:16 AM, Alex Kleider wrote: > On 2017-07-23 01:06, Anish Tambe wrote: >>> for line in file: >> >> This line is not required as the you have opened your file to 'f'. >> 'file' is a built-in class. Type - >> help(file) >> on the interpreter to know more about it. > > This appears to

Re: [Tutor] basic decorator question

2017-07-24 Thread Mats Wichmann
On 07/24/2017 08:33 AM, bruce wrote: > Hi. > > I've seen sites discuss decorators, as functions that "wrap" and > return functions. > > But, I'm sooo confuzed! My real question though, can a decorator have > multiple internal functions? All the examples I've seen so far have a > single internal

Re: [Tutor] class newbie

2017-07-23 Thread Mats Wichmann
On 07/23/2017 02:42 PM, Michael C wrote: > never mind, I forgot to put 'self' in the method definition! class mahschool: def print(self): print('Say something') a = mahschool() a.print() Indeed. The error message was clear on this - but not in a way that's always instructive

Re: [Tutor] new to python

2017-07-24 Thread Mats Wichmann
On 07/24/2017 04:32 PM, N6Ghost wrote: > update code: > f = open("C:\coderoot\python3\level1\inputfile.txt", 'r') > for line in f: > for line in f: > print(line.rstripe()) > > f.close() > > > C:\coderoot\python3\level1>python secondscript.py > Traceback (most recent call

Re: [Tutor] Problems with pytz module

2017-07-19 Thread Mats Wichmann
> On 19/07/17 20:58, Daniel Bosah wrote: don't see a lot of benefit to using pytz here... just my opinion. the question does give a chance to annotate the example with some thoughts, though; take them for what they're worth. import datetime import pytz class Account: """Simple account

Re: [Tutor] Quick Pythonic Style Tips

2017-07-22 Thread Mats Wichmann
On 07/22/2017 07:46 AM, Alan Gauld via Tutor wrote: > On 22/07/17 12:20, Abdur-Rahmaan Janhangeer wrote: > >> As a user switching between some languages, it took sometimes before i >> discovered that there was a styling guide in python > > There are style idioms in most languages although not

Re: [Tutor] centos 7 - new setup.. weird python!

2017-07-19 Thread Mats Wichmann
On 07/19/2017 02:48 PM, bruce wrote: > Hi. > > Testing setting up a new Cnntos7 instance. > > I ran python -v from the cmdline... and instantly got a bunch of the > following! Pretty sure this isn't correct. > > Anyone able to give pointers as to what I've missed. It is expected, actually.

Re: [Tutor] Installing Python3.6.1 on Ubuntu 16.04.2

2017-07-02 Thread Mats Wichmann
what was the error? nothing came through On July 2, 2017 9:06:07 AM MDT, Joseph VOGTEMBING via Tutor wrote: >I have a fresh install of Ubuntu 16.04.2, on which I try to install >Python3.6.1, and I have done this multiple times in the past, but for >some reason I tried it 3

Re: [Tutor] Query regarding output

2017-06-29 Thread Mats Wichmann
On 06/29/2017 03:02 AM, Alan Gauld via Tutor wrote: > On 29/06/17 03:14, shubham goyal wrote: > >> This Question is asked in some exam. i am not able to figure it out. >> >> a = [0, 1, 2, 3] >> for a[-1] in a: >> print(a[-1]) >> >> its giving output 0 1 2 2 >> >> it should be 3 3 3 3 as a[-1]

Re: [Tutor] dictionaries are same but returning false

2017-07-05 Thread Mats Wichmann
On 07/05/2017 11:09 AM, Marc Tompkins wrote: > On Wed, Jul 5, 2017 at 9:51 AM, Ashfaq wrote: > >> Hi Peter, >> The way you find the issue is really cool! Very cool! :) >> >> > I agree - that is very cool. But I have also made this sort of mistake a > few times, and found

Re: [Tutor] Why use main() ?

2017-07-05 Thread Mats Wichmann
On 07/05/2017 09:45 AM, Zachary Ware wrote: > On Wed, Jul 5, 2017 at 10:37 AM, David Rock wrote: >> I personally find using main() cumbersome, but many examples I come >> across use main(). Is there some fundamental benefit to using main() >> that I'm missing? > > In no

Re: [Tutor] Difference between %f and %F string formatting?

2017-04-27 Thread Mats Wichmann
F means print it in uppercase. That's really an edge case for a float, that would only apply to the special values infinity and not-a-number. On April 26, 2017 8:08:16 PM MDT, boB Stepp wrote: >My Google-fu must be weak tonight. I cannot find any discernible >difference

Re: [Tutor] Sets question

2017-04-27 Thread Mats Wichmann
On 04/26/2017 06:33 PM, Phil wrote: > Another question I'm afraid. > > If I want to remove 1 from a set then this is the answer: > > set([1,2,3]) - set([1]) > > I had this method working perfectly until I made a change to cure another bug. > > So, I have a set represented in the debugger as

Re: [Tutor] Recommended Python Compiler

2017-07-30 Thread Mats Wichmann
since this all opinions :), I don't think idle is worth bothering with. for editor that can do ide like things, consider atom (free, get a bunch of plugins) or sublime text (not free). for a full ide, pycharm is great (community edition free). for a lightweight ide to get started, i liked

Re: [Tutor] How does len() compute length of a string in UTF-8, 16, and 32?

2017-08-08 Thread Mats Wichmann
eh? the bytes are ff fe h 0 0xff is not literally four bytes, its the hex repr of an 8bit quantity with all bits on On August 8, 2017 9:17:49 PM MDT, boB Stepp wrote: >On Mon, Aug 7, 2017 at 10:01 PM, Ben Finney > wrote: >> boB Stepp

Re: [Tutor] Error with sqlalchemy

2017-08-01 Thread Mats Wichmann
On 08/01/2017 05:13 AM, rakesh sharma wrote: > Hi All > > > I am getting an error in python. Its a flask app that I am doing > > I am getting the error > > TypeError: utf_8_decode() argument 1 must be string or buffer, not long > > at this point in the code > > ship_schedules =

Re: [Tutor] unorderable types

2017-08-06 Thread Mats Wichmann
On 08/06/2017 11:35 AM, boB Stepp wrote: > So these final two "if" groupings should be _outside_ your while loop: > > while guessesTaken < 6: > > > if guess_value == number: > print('good job, ' + myName + '! you guessed my number in', > guessesTaken, 'guesses!') > > else: >

Re: [Tutor] help with subprocess module

2017-08-19 Thread Mats Wichmann
On 08/19/2017 04:13 AM, kay Cee wrote: > I made a python script that will update a Ubuntu Server every second and > writes asuccess message and date to a log file, but for some reason the > file is not being written to. > > Here is the Script: > > #!/usr/bin/python3 > > import subprocess >

Re: [Tutor] (no subject)

2017-08-17 Thread Mats Wichmann
On 08/17/2017 05:45 AM, Howard Lawrence wrote: > Yes, it does. > > On Aug 16, 2017 8:02 PM, "Zachary Ware" > wrote: > > Hi Howard, > > On Wed, Aug 16, 2017 at 5:36 PM, Howard Lawrence <1019sh...@gmail.com> > wrote: >> class Address: >> def

Re: [Tutor] cffi version mismatch stalling pip install pygit2

2017-05-14 Thread Mats Wichmann
On 05/12/2017 01:44 PM, MR ZenWiz wrote: > How do I fix this? > > We are using a newer version of libgit2 than the standard release > (libgit2.0.25.0 instead of libgit2.0.24.0 - some hard dependency in > our code). > > However, after I install libgit2 (25), I get this error chain: If you use a

Re: [Tutor] Flowchart

2017-05-10 Thread Mats Wichmann
On 05/10/2017 05:26 PM, Alan Gauld via Tutor wrote: > On 10/05/17 00:25, adil gourinda wrote: >> As you requested, I uploaded my flowcharts on a web storage link as: > > Thanks, although it would have helped if you included > your original message since I am the only person to > see it! It never

Re: [Tutor] urllib ... lost novice's question

2017-05-09 Thread Mats Wichmann
this is one of those things where if what you want is simple, they're all usable, and easy. if not, some are frankly horrid. requests is the current hot module. go ahead and try it. (urllib.request is not from requests, it's from urllib) On May 8, 2017 9:23:15 AM MDT, Rafael Knuth

Re: [Tutor] custom comparator with ordered list

2017-06-26 Thread Mats Wichmann
On 06/26/2017 10:38 AM, Anish Kumar wrote: > >> anish singh wrote: >> >>> I need a custom comparator. >>> >>> dictionary = {a:[b,c], d:[e,f]} >>> >>> If both 'b' and 'e' belong to the same bin if would help alot if your problem statement included a description of what "same bin" is. > Well no,

Re: [Tutor] how-to generate specific lines of text from two python lists

2017-06-26 Thread Mats Wichmann
On 06/25/2017 12:44 PM, Tahir Hafiz wrote: > Thanks Alan and Peter, > > Alan you are right this could be solved via an SQL statement but I was > asked to finish the python script. > Anyways, this worked and helped to solve the problem in the end: > > # Create iterator object, dictionary which

[Tutor] urljoin (was: Re: Tutor Digest, Vol 160, Issue 26)

2017-06-20 Thread Mats Wichmann
On 06/20/2017 02:34 AM, angela ebirim wrote: > Hi, > > I'm trying to dynamically build a url in python and have tried using: can see a couple of things... > > #file.py > > import json > import requests > from urllib.parse import urljoin > > baseUrl = " >

Re: [Tutor] __str__ on a subclass

2017-06-19 Thread Mats Wichmann
On 06/19/2017 01:32 PM, Evuraan wrote: > Greetings! > > > #!/usr/bin/python3 > class Employee: > """Class with FirstName, LastName, Salary""" > def __init__(self, FirstName,LastName, Salary): > self.FirstName = FirstName > self.LastName = LastName

Re: [Tutor] Fwd: Re: Using files to read data

2017-06-27 Thread Mats Wichmann
On 06/27/2017 05:01 AM, Alan Gauld via Tutor wrote: > Forwarding to list > > Please always use ReplyAll or ReplyList when responding to list mail. > > > > Forwarded Message > > i apologize. i guess it didn’t attach correctly. > my issue is how do i get it out of my file and

Re: [Tutor] deleting elements of a dictionary

2017-05-19 Thread Mats Wichmann
On 05/19/2017 11:17 AM, Alan Gauld via Tutor wrote: > On 19/05/17 15:23, Michael C wrote: >> list(read_dictionary) converts the dictionary into a list right? How can >> you save the list as a dictionary? > > Nope, list() produces a new list object containing the > keys of the dictionary. In the

Re: [Tutor] deleting elements of a dictionary

2017-05-20 Thread Mats Wichmann
On 05/19/2017 02:54 PM, Mats Wichmann wrote: > On 05/19/2017 11:17 AM, Alan Gauld via Tutor wrote: >> On 19/05/17 15:23, Michael C wrote: >>> list(read_dictionary) converts the dictionary into a list right? How can >>> you save the list as a dictionary? >> &g

Re: [Tutor] Looping through Dictionaries

2017-05-23 Thread Mats Wichmann
On 05/23/2017 11:38 AM, Rafael Knuth wrote: > I wrote a function (shopping list) which calculates the total price of > the purchase (quantity * price) as well as the stock change (stock - > quantity). I know the latter is imperfect (my function does not take > into account if items are out of

Re: [Tutor] How to deploy seamless script updates to your "clients"?

2017-05-25 Thread Mats Wichmann
On 05/24/2017 04:10 PM, Juan C. wrote: > I have some Python 3.6.0 scripts that my co-workers use for some small > and medium tasks. Whenever I have time I fix some bugs and add some > features to said scripts to make their lives (and mine :D) easier, but > there's a problem: I need to send a new

Re: [Tutor] Problem with if statements and else statements

2017-05-28 Thread Mats Wichmann
On 05/27/2017 06:14 PM, boB Stepp wrote: > Hello Jalen! > > On Sat, May 27, 2017 at 4:19 PM, Jalen Barr wrote: >> >> In this code it always changes the PlaceHolder to 0 no matter what Month is >> set to >> >> Month ="September" >> >> if Month == "January" or "1": >>

Re: [Tutor] How to deploy seamless script updates to your "clients"?

2017-05-28 Thread Mats Wichmann
On 05/27/2017 05:33 AM, M Hashmi wrote: > That's where Git or other version control systems come in. You can edit or > upgrade creating a branch and when a branch tested at your side. You can > push it with new tag like "some module changed". I guess this is how it > works for everyone. All your

Re: [Tutor] New blog that has solution for python programs

2017-06-02 Thread Mats Wichmann
On 06/02/2017 11:27 AM, meenu ravi wrote: > Hello, > > I'm planning to create a blog that provides solution with explanation for > python programming challenges available in websites like Hackerearth, > codecademy, etc., so that if others also share their solution along with > explanation in the

Re: [Tutor] New blog that has solution for python programs

2017-06-03 Thread Mats Wichmann
> I don't think "what the authors might want" is the only factor here. > Personally, I think these programming challenge sites probably do more > harm than good, discouraging people that they're not good enough to be a > programmer because they can't solve the (often exceedingly tricky) >

Re: [Tutor] Coming from R, what's a good IDE editor? I've tried PyCharm and Spyder

2017-06-03 Thread Mats Wichmann
On 06/02/2017 11:46 AM, C W wrote: > Dear Python list, > > I am an R user learning Python. What is a good editor? > > 1) Pycharm > PyCharm evaluates the entire script, I just want to change a few lines in > the script. > For example, > > import matplotlib.pyplot as plt > import numpy as np > >

Re: [Tutor] sub-modules and python3

2017-05-31 Thread Mats Wichmann
On 05/31/2017 11:22 AM, john wrote: > Hi folks, > > In the past I used a simple "import filename" for sub-modules in python > 2. With python 3 I have run into errors reported (file not found) using > python 2 import statements. But I'm not asking how to correct the > import as I am able to

Re: [Tutor] Fahrenheit to Celsius Conversion another problem and Programming Paradigm

2017-06-14 Thread Mats Wichmann
On 06/14/2017 12:18 PM, Sibylle Koczian wrote: > Correct usage would be: > > if myvar == val1 or myval == val2: > or > if myvar in (val1, val2): Just piling on here to say I find the second form very useful to collect arguments in a "friendly" way, if you don't have a reason to very rigidly

Re: [Tutor] Raspberry pi 2 python help

2017-06-13 Thread Mats Wichmann
On 06/13/2017 08:08 AM, DJ VIN Lom wrote: > Can i create a script to have my pi change to a certian directory > automaticlly after booting. I want it to be in a directory so when i ssh > into it its ready and i dont need to spend time to do it. As well i dont > want to carry a keyboard mouse and

Re: [Tutor] Using Python to access .txt files stored behind a firewall as .exe files

2017-05-02 Thread Mats Wichmann
On 05/01/2017 06:12 PM, Ian Monat wrote: > Thank you for the reply Mats. > > I agree the fact that files are wrapped in an .exe is ridiculous. We're > talking about a $15B company that is doing this by the way, not a ma and pa > shop. Anyways... > > If I understand you correctly, you're saying

Re: [Tutor] Index Out of Range?List

2017-05-04 Thread Mats Wichmann
> atm_chg.append(float( line.split()[-1] )) > > > np.asarray({atm_chg}) > > Execution still generates the errors: > > runfile('/home/comp/Apps/Python/Testing/ReadFile_2.py', > wdir='/home/comp/Apps/Python/Testing') that means you have a blank line it's reading, the result of

Re: [Tutor] Using Python to access .txt files stored behind a firewall as .exe files

2017-05-01 Thread Mats Wichmann
On 05/01/2017 03:44 PM, Alan Gauld via Tutor wrote: > On 01/05/17 18:20, Ian Monat wrote: >> ... I've written a script using the requests module but I >> think a web scraper like Scrapy, Beautiful Soup or Selinium may be >> required. > > I'm not sure what you are looking for. Scrapy, BS etc will

Re: [Tutor] I can not display the answer of the Limit when I click the Button Answer.

2017-09-13 Thread Mats Wichmann
On 09/13/2017 09:03 AM, edmundo pierre via Tutor wrote: >                                                            That is my code > below. I used tkinter to calculate the limit of a function. I used Grid > geometry, but when I click the button Answer, but nothing comes out so I do > not know

Re: [Tutor] Python Help

2017-09-16 Thread Mats Wichmann
On 09/15/2017 10:25 AM, Alan Gauld via Tutor wrote: > On 15/09/17 04:08, Pratyusha Thundena wrote: >> How do check to see if string ‘garden’ contains a >> vowel(a, e , i , o, u , or y) using a for loop? > > Hi, this sounds like homework and we won't do > your homework for you, but we do give

Re: [Tutor] subprocess.getstatusoutput : UnicodeDecodeError

2017-09-21 Thread Mats Wichmann
On 09/21/2017 04:46 PM, Evuraan wrote: > Greetings! > > My search-fu failed me, so thought of finally asking this question here. > > > How can I work around this issue where subprocess.getstatusoutput gives > up, on Python 3.5.2: You picked a fun one! First off, subprocess.getstatusoutput is

Re: [Tutor] I have a problem

2017-09-23 Thread Mats Wichmann
On 09/23/2017 03:46 AM, Sibylle Koczian wrote: > Am 22.09.2017 um 23:41 schrieb Mizav: >> You are using pip version 7.1.2, however version 9.0.1 is available. >> You should consider upgrading via the 'python -m pip install --upgrade >> pip' >> command. >> > > And what is the problem? Did you

Re: [Tutor] How do I scan memory for singles, doubles and so on?

2017-10-07 Thread Mats Wichmann
it might help if you mention what you are trying to do. if it is forensics, there a bunch of python tools in that area. your problem may already have solutions you could use. On October 7, 2017 3:00:25 PM MDT, Michael C wrote: >Hi all: > >I am working on a

Re: [Tutor] using while loop for read process memory

2017-10-08 Thread Mats Wichmann
On 10/08/2017 11:20 AM, Michael C wrote: > Hi all: > Now, I know the problem is not with VirtualQueryEx, because if I comment out > the red part and just run VirtualQueryEx, it would actually skim through > all regions > without a single error. > > The red part is the problem. what red part?

Re: [Tutor] How do I scan memory for singles, doubles and so on?

2017-10-09 Thread Mats Wichmann
On 10/07/2017 09:18 PM, Michael C wrote: > I am following some examples online such as this one: > https://social.msdn.microsoft.com/Forums/vstudio/en-US/ce0cc398-2b96-4688-b8a4-b5f4c9ebc064/memory-searcher-with-virtualqueryex-and-readprocessmemory?forum=vclanguage > > > i think I got most of it

  1   2   3   4   >