Re: [Tutor] Exponential function

2017-02-15 Thread Alan Gauld via Tutor
On 15/02/17 04:43, eryk sun wrote: >> value = 1e5 # or 3e7 or whatever... > > 10**5 is an int and 1e5 is a float. Good point, I'd forgotten about that distinction. > Replacing 10**5 with 10 is a compile-time optimization And didn't know about that one. Thanks for the clarification. --

Re: [Tutor] Tutor Digest, Vol 156, Issue 33

2017-02-14 Thread Alan Gauld via Tutor
As per my offline reply, just send messages to the list and the whole group will act as a virtual mentor. One other thing though. Please start new topics with a new message. Do NOT reply to an existing thread as it messes up the archives. And especially do not reply to a digest message. And use

Re: [Tutor] Exponential function

2017-02-14 Thread Alan Gauld via Tutor
On 14/02/17 12:03, Aaliyah Ebrahim wrote: > For the function 1*10^x, is there a specific way of computing *10^x or will > it just be the following : > > 1*10**x To compute it if you don't know x in advance then yes, use something like value = 10**x But if you know the value in advance you can

Re: [Tutor] NameError: name 'hurst' is not defined

2017-02-14 Thread Alan Gauld via Tutor
On 14/02/17 10:11, Alan Gauld via Tutor wrote: >>>> ts.adfuller(goog['Adj Close'], 1 > > there seems to be a missing closing paren here? > Also where does 'ts' come from, its not defined above? Ah! I see from Peters post that I missed the first line of code. But

Re: [Tutor] NameError: name 'hurst' is not defined

2017-02-14 Thread Alan Gauld via Tutor
On 14/02/17 01:55, Allan Tanaka via Tutor wrote: > Hi. Not sure why this code produces the error like this. This error appears > when i run the code of print "Hurst(GBM): %s" % hurst(gbm): > Traceback (most recent call last): File "", line 1, in > print "Hurst(GBM): %s" %

Re: [Tutor] Q about .join() Thanks!

2017-02-13 Thread Alan Gauld via Tutor
On 13/02/17 18:34, SIJIA CHEN wrote: > I find out that the outcome for using .join() on a dictionary is > totally different than it using on list or string. Not really, it just looks like that :-) > > >>> seq4 = {'hello':1,'good':2,'boy':3,'doiido':4} > >>>

Re: [Tutor] Fwd: Re: GUI for ANSI colors

2017-02-13 Thread Alan Gauld via Tutor
On 14/02/17 00:58, Alan Gauld forwarded: > red = '\033[91m' > yel = '\033[93m' > blu = '\033[34m' > grn = '\033[32m' These are indeed the ANSI codes for the colours but ANSI codes only work in an ANSI terminal and GUIs are not ANSI terminals. Instead they have their own ideas on colours and you

Re: [Tutor] Access a .tcl file in python

2017-02-13 Thread Alan Gauld via Tutor
On 13/02/17 19:37, Lily ANTONY wrote: > I have a .tcl file.Does anyone know how to load a .tcl file in to python?I > need to call the .tcl file in > a python program..Thanks! In general you can't run code for one language in a program written in another language. (There are a few exceptions,

[Tutor] Fwd: Re: GUI for ANSI colors

2017-02-13 Thread Alan Gauld via Tutor
= ascii_letters + digits word = ''.join(choice(chars) for i in range(12)) red = '\033[91m' yel = '\033[93m' blu = '\033[34m' grn = '\033[32m' colors = [red, yel, blu, grn] final_word = ''.join(choice(colors) + char for char in word) print(final_word) 2017-02-13 12:28 GMT+01:00 Alan Gauld via Tutor

Re: [Tutor] Help with random in Tkinter

2017-02-13 Thread Alan Gauld via Tutor
On 13/02/17 13:30, Lisa Hasler Waters wrote: > It runs fine when we use IDLE. But, we love PyCharmEDU as it is much more > user-friendly and so we hope to run the same programs in it as we can in > IDLE. That shouldn't make much difference unless PyCharm sets its default folders differently?

Re: [Tutor] Resending question with smaller file

2017-02-13 Thread Alan Gauld via Tutor
On 13/02/17 16:06, Lisa Hasler Waters wrote: > We are trying to use the random function in the Tkinter module > from tkinter import * > import random This looks for the random module and tries your local folder first. If you have a file called random.py it tries to import that. Based on your

Re: [Tutor] GUI for ANSI colors

2017-02-13 Thread Alan Gauld via Tutor
On 13/02/17 09:40, Freedom Peacemaker wrote: > I'm trying to put my script with randomly colored letters (ANSI escape > code) into GUI but cant find any. I've tried tkinter but it isn't good > choice. Why not? It can certainly do what you want. As can virtually any other GUI toolkit. But

Re: [Tutor] Issue with set_value function

2017-02-13 Thread Alan Gauld via Tutor
On 13/02/17 07:23, Yap Gerald wrote: > I have a problem with the functions set_value which I could not find a > solution on the net. This is very confusing. You don't use set_value() anywhere in the code you posted? You don't describe what the actual problem with set_ value() is. And most of

Re: [Tutor] Can we talk with a Real Time Clock hardware by Python?

2017-02-13 Thread Alan Gauld via Tutor
On 13/02/17 06:44, Thanh Tuan Le wrote: > I have a board that have a Real Time Clock (RTC) chip on that board. I need > to communicate with that RTC chip by Python. > > Following is my hardware info. > - Board from Variscite: >

Re: [Tutor] Accessing an entry value input by the user

2017-02-12 Thread Alan Gauld via Tutor
On 12/02/17 20:01, Pooja Bhalode wrote: > Thank you so much. I got stuck in another section: It would be helpful if you gave more details of exactly how you get stuck. What is happening(or not) that puzzles you. Otherwise we just have to guess at what you mean. Anyway, here goes... > root=Tk()

Re: [Tutor] ISSUE WITH PYTHON 3,5 API RUNTIME

2017-02-12 Thread Alan Gauld via Tutor
On 12/02/17 19:10, ViRuZ Fx . wrote: > Hello fellow programmers of Python, Im here writing you this because, since > I got a virus and my computer reseted to 0, I have no idea what reset to 0 means. Did you reinsatall Windows and all your applications? Did you use the Windows repair tool? > I

Re: [Tutor] Accessing an entry value input by the user

2017-02-11 Thread Alan Gauld via Tutor
print i > textvar = "\t Conc"+str(i+1) > Label(frame1, text=textvar).grid(row=(9+i), column=0,sticky=W) > conclowerentry = Entry(frame1) > conclowerentry.grid(row= (9+i), column = 1, sticky = W) > concupperentry = Entry(frame1) >

Re: [Tutor] Accessing an entry value input by the user

2017-02-11 Thread Alan Gauld via Tutor
On 11/02/17 15:28, Pooja Bhalode wrote: > I am trying to create a label and an entry widget. I am not able to > understand as to how to access the value input by the user in the entry > widget. > > Label(frame1, text = "Number of species:").grid(row=0, column = 1, sticky=W) > entrynumberspecies

Re: [Tutor] Climata package

2017-02-10 Thread Alan Gauld via Tutor
On 10/02/17 20:07, fei fan wrote: > Hi tutor, > > Do you know of any good resources to extract data using the climata > package and to convert these data in .geojson format? This forum is for the core language and standard library so this is a bit off topic, you might get a better response on

Re: [Tutor] CheckButtons reset to default values

2017-02-10 Thread Alan Gauld via Tutor
On 10/02/17 15:56, Pooja Bhalode wrote: > root = Tk() > root.title("Design of Experiments with Parameter Estimation") > root.geometry("1000x1000") > > def DesignPoint(): > rootdesign=Tk() You should o0nly have one root. This create a new root everytime you xcall Designpoint and even if

Re: [Tutor] Can I can use subprocess module for connecting to linux from windows

2017-02-10 Thread Alan Gauld via Tutor
On 10/02/17 06:48, Basavaraj Lamani wrote: > putty, I will do SSH connection to Linux machine(VM). I enter username and > password to access Linux machine(VM) then I enter different commands to > install application in Linux machine. > > Automation: I want to automate above manual task by using

Re: [Tutor] Help

2017-02-10 Thread Alan Gauld via Tutor
On 10/02/17 02:05, Sasiliyu Adetunji wrote: > Please assist with this assignment > > Write a function my_sort which takes in a list of numbers (positive > integers). > > The function should return a list of sorted numbers such that odd numbers > come first and even numbers come last. def

Re: [Tutor] Find (list) strings in large textfile

2017-02-09 Thread Alan Gauld via Tutor
On 09/02/17 19:15, Sylwester Graczyk wrote: > Hi all, > I'm try to write a code to search strings (from one textfile with lists > of strings) in second large text file. > but script doesn't search my lists in entire file (not complete output file) The problem is that you open the data file once,

Re: [Tutor] Help with Multiple Inheritance in Classes

2017-02-09 Thread Alan Gauld via Tutor
On 09/02/17 10:42, Vusa Moyo wrote: > Thanks so much. You've been a great help. > > You have confirmed that the lecture's question is flawed. It is not, it is exactly right. (Albeit unusual in its use of class attributes) but there is nothing wrong with the code, only the way you were trying to

Re: [Tutor] Help with Multiple Inheritance in Classes

2017-02-09 Thread Alan Gauld via Tutor
On 09/02/17 09:25, Vusa Moyo wrote: > class Cat: > name = "" > kind = "cat" > color = "" > value = 100.00 > > def description(self): > desc_str = "%s is a %s %s cat worth R%.2f." % (self.name, > self.color, self.kind, self.value) > return desc_str > > The

Re: [Tutor] Help on this assignment

2017-02-09 Thread Alan Gauld via Tutor
On 09/02/17 08:10, Sasiliyu Adetunji wrote: > Write a function called remove_duplicates which will take one argument > called string. This string input will only have characters between a-z. > > The function should remove all repeated characters in the string and return > a tuple with two

Re: [Tutor] Explorer bar window(wxpython) combined to Tkinter

2017-02-08 Thread Alan Gauld via Tutor
On 08/02/17 23:09, Pooja Bhalode wrote: > But, I want to create this in the original GUI window that I am working in > using Tkinter. However, when I tried importing it, I am not able to > understand how to deal with different roots, Unfortunately you cannot mix toolkits. You either use Tkinter

Re: [Tutor] Help on shoppingcart

2017-02-08 Thread Alan Gauld via Tutor
On 08/02/17 10:04, Sasiliyu Adetunji wrote: > Pls help me on this shoppingcart assignment Sure. You have a very specific set of tasks. Which bit are you stuck on? What have you tried? Show us your code and we can help get it working. > Create a class called ShoppingCart > Create a

[Tutor] Rock,Paper Scissors (was no subject)

2017-02-08 Thread Alan Gauld via Tutor
On 08/02/17 10:02, တာန္ခတ္သန္ wrote: > Thanks for your answers. Your explanation makes me understand what I > didn't understand and it discourages me to go on Python in other way > as I feel like this doesn't suit to me. :'( Don't be discouraged. Your central program was very nearly right and

Re: [Tutor] Help with Multiple Inheritance in Classes

2017-02-08 Thread Alan Gauld via Tutor
On 08/02/17 07:11, Vusa Moyo wrote: > I have a suspicion my lecturer's question is flawed, so I'd like to pose it > to you guys to confirm my suspicions. I think your interpretation of the question is flawed. See Peter's reply for why. However another point is > class Cat: > name = ""

Re: [Tutor] (no subject)

2017-02-08 Thread Alan Gauld via Tutor
On 07/02/17 21:09, တာန္ခတ္သန္ wrote: > RockPaperScissors game using dictionary. I have written my code and it > doesn't work at all. So what does it do? Crash your PC? Give an error? Run silently and stop? You need to be precise when telling us these things. If you get an error message send us

Re: [Tutor] Multiple tabs using tkinter

2017-02-07 Thread Alan Gauld via Tutor
On 07/02/17 19:51, Zachary Ware wrote: >> But Tix has over 40 extra widgets including a tabbed notepad, >> balloon, meter, shell and and a very powerful (but undocumented!) >> grid control. > > Very little of tkinter is actually documented outside of the official > Tcl/Tk docs, unfortunately.

Re: [Tutor] Multiple tabs using tkinter

2017-02-07 Thread Alan Gauld via Tutor
On 07/02/17 18:59, Alan Gauld via Tutor wrote: > It should be easy since its just native Tcl code, there's no C Scratch that, I just found a C API for Tix so I guess it has some C after all. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.

Re: [Tutor] Tkinter Calendar to receive user entry.

2017-02-07 Thread Alan Gauld via Tutor
On 07/02/17 19:40, Peter Otten wrote: >>> from ttkcalendar import Calendar >> >> Doesn't work for me in either Python 3.6.0 or in Python 2.7.6 >> >> Which version of 2.7 are you using? > > The distribution's Python 2.7.6 on Linux Mint 17. After fixing the import > statements... OK, I went back

Re: [Tutor] Tkinter Calendar to receive user entry.

2017-02-07 Thread Alan Gauld via Tutor
On 07/02/17 10:18, Peter Otten wrote: > $ cat demo.py > #!/usr/bin/env python > import calendar > import ttk > import Tkinter > from ttkcalendar import Calendar Doesn't work for me in either Python 3.6.0 or in Python 2.7.6 Which version of 2.7 are you using? -- Alan G Author of the Learn to

Re: [Tutor] Error when trying to use classes

2017-02-07 Thread Alan Gauld via Tutor
On 07/02/17 15:34, Rafael Skovron wrote: > My general workflow is I edit in vim, then invoke python3 interpreter, > import the module and try to use the Class and methods from the class. > > For example, importing customer.py and assigning this object yields: > rafael =

Re: [Tutor] Multiple tabs using tkinter

2017-02-07 Thread Alan Gauld via Tutor
On 07/02/17 16:41, Zachary Ware wrote: > Full disclosure, I've never actually used Tix beyond making it build > with the rest of CPython on Windows and making sure it actually worked > on one of my Linux buildbot workers. I have only ever seen it as a > maintenance headache :) The beauty of Tix

Re: [Tutor] Multiple tabs using tkinter

2017-02-07 Thread Alan Gauld via Tutor
On 07/02/17 03:56, Pooja Bhalode wrote: > you mentioned that there are multiple toolkits which can be used instead of > tkinter. I was also looking into wxpython for building a explorer bar. > Mainly, I have to build a software entirely using python and thus, needed > all these things put in

Re: [Tutor] Help with this work

2017-02-07 Thread Alan Gauld via Tutor
On 07/02/17 04:08, Sasiliyu Adetunji wrote: > I have been working on yhis assignment You are asking for help but in what regard? There is no question or problem statement in your post? I've put some general comments below... > class ShoppingCart(object): > > def __init__(self): >

Re: [Tutor] Multiple tabs using tkinter

2017-02-07 Thread Alan Gauld via Tutor
On 07/02/17 03:31, Zachary Ware wrote: > ttk rather than Tix; Tix is unmaintained and soft-deprecated in 3.6+. Really? Thats a pity. Tix was supposed to be the module with the extra widgets and ttk was purely the themed versions of same. Its a shame to confuse their purposes. OTOH it does mean

Re: [Tutor] Help Please on python

2017-02-07 Thread Alan Gauld via Tutor
On 07/02/17 02:12, Laura Garcia wrote: > I need to create a python code that should simulate throwing darts by > random landing between (a random x and a random y)0 and 1. and the program > should print out number of darts that land within a rectangle. Look in the random module. There are a

Re: [Tutor] Tkinter Calendar to receive user entry.

2017-02-07 Thread Alan Gauld via Tutor
On 07/02/17 00:24, Pooja Bhalode wrote: > I am trying to create a calendar using tkinter GUI such that when the user > opens the GUI, So far as I'm aware there is no such Calendar widget in the standard modules, you would need to find a third party module. > Can some one please help me with

Re: [Tutor] Basic Tutorial for Python

2017-02-06 Thread Alan Gauld via Tutor
On 06/02/17 16:13, Hüseyin Ertuğrul wrote: > Hello all, > I am a system engineer and I want to learn python language. > I don't know any program language That's a common request and the python.org site has a whole page dedicated to folks like you.

Re: [Tutor] Multiple tabs using tkinter

2017-02-06 Thread Alan Gauld via Tutor
On 06/02/17 16:40, Pooja Bhalode wrote: > I was wondering if someone could help me regarding multiple tabs in > tkinter. Look at the tabbed notebook in the Tix module. It should do what you want. I give a tutorial on its use in my recent book but you can also find online tutorials, especially

Re: [Tutor] sort() method and non-ASCII

2017-02-06 Thread Alan Gauld via Tutor
On 06/02/17 12:13, boB Stepp wrote: py> 'pi = \N{GREEK SMALL LETTER PI}' 'pi = π' >>> >>> >>> You have surprised me here by using single quotes to enclose the >>> entire assignment statements. I thought this would throw a syntax >>> error, but it works just like you show. What is going

Re: [Tutor] Syntax error while attempting to type in multiline statements in the interactive interpreter

2017-02-05 Thread Alan Gauld via Tutor
On 05/02/17 01:29, boB Stepp wrote: > But it seems to me on further thought that both REPL and what seems > most consistent to me, "...wait until all the input has been read, > then evaluate it all..." amounts to the same thing in the case of > entering function definitions into the interpreter.

Re: [Tutor] Syntax error while attempting to type in multiline statements in the interactive interpreter

2017-02-04 Thread Alan Gauld via Tutor
On 04/02/17 22:56, boB Stepp wrote: > On Sat, Feb 4, 2017 at 4:40 PM, David wrote: >> On 5 February 2017 at 09:02, boB Stepp wrote: >>> py3: a >>> ['Mary', 'had', 'a', 'little', 'lamb', 'break'] >>> py3: for w in a: >>> ... print(w) >>> ...

Re: [Tutor] Copy/Paste in Tkinter

2017-02-04 Thread Alan Gauld via Tutor
On 04/02/17 16:09, Pooja Bhalode wrote: > I do not have a text box, but a GUI similar to a word editor. That sounds like a text box to me!? What are you using to enter the text if not a Text widget? > I was learning from youtube videos about this. You can start with the GUI topic in my

Re: [Tutor] Tkinter Copy/Paste/Cut functionalities

2017-02-04 Thread Alan Gauld via Tutor
On 04/02/17 02:34, Pooja Bhalode wrote: > I came across some snippets of the code to do this but using a self class. I'm not sure what you mean by a "self class"? > I was wondering if some one could help me create these functionalities in a > manner similar to the following code. (similar to

Re: [Tutor] Copy/Paste in Tkinter

2017-02-04 Thread Alan Gauld via Tutor
On 04/02/17 00:24, Pooja Bhalode wrote: > I am trying to write a simple Tkinter code in Python in order to > demonstrate select/copy/paste/cut functionalities using keyboard keys and > menu options. You are going a fairly long winded way about it. Rather than generating events use the Text/Entry

Re: [Tutor] Best Python 3 module to create simple text editor in Windows command prompt?

2017-02-03 Thread Alan Gauld via Tutor
On 03/02/17 04:42, boB Stepp wrote: > On Thu, Feb 2, 2017 at 8:35 PM, eryk sun wrote: >>> >> Try using curses [1]. Christoph Gohlke has a port for Windows Python >> based on the PDCurses library [2]. > > Thanks, Eryk. I did not realize that curses had been ported to >

Re: [Tutor] Lock File Usage

2017-01-30 Thread Alan Gauld via Tutor
On 30/01/17 14:45, ad^2 wrote: > So, IF: no lock file, create a lock file, execute, delete lock file when > finished successfully. ElSE: the script is running, exit. Then, cron will > try again an hour later. That's probably the most common way of doing what you want. But you need to make

Re: [Tutor] cannot open idle in 3.6 version but can in 2.7

2017-01-26 Thread Alan Gauld via Tutor
On 25/01/17 20:56, Wiley, Brian wrote: > I would like to learn and utilize both python versions. > For some reason when access shell for 3.6 I get this message: > > "Your Python may not be configured for Tk. **", file=sys.__stderr__) That usually means you've installed a Python that has not

Re: [Tutor] Feature or ... after python 2.7

2017-01-25 Thread Alan Gauld via Tutor
On 25/01/17 17:32, source liu wrote: >>> $cat test.py >>> #!/bin/env python >>> print "I am python" >>> >>> $perl test.py >>> I am python >>> >> >> That is just because this particular print statement >> is compatible with Perl. If you had tried anything >> more complex then it would have bombed.

Re: [Tutor] Feature or ... after python 2.7

2017-01-25 Thread Alan Gauld via Tutor
On 25/01/17 02:55, source liu wrote: > 2.7. (2.7.16 if I remembered it correctly), one could run python script > with perl > > $cat test.py > #!/bin/env python > print "I am python" > > > $perl test.py > I am python > That is just because this particular print statement is compatible with

Re: [Tutor] Another way to strip?

2017-01-19 Thread Alan Gauld via Tutor
On 19/01/17 21:29, ad^2 wrote: > I'm looking for a cleaner more elegant way to achieve stripping out a file > name from a list which contains a path and file extension. > > Ex. > > my_list = ['/var/tmp/02_80_5306__2017_01_19_08-36-57_4918_0.zip', >

Re: [Tutor] How can I run this test script using selenium while making connection and running the code I am facing issue Please see my code below

2017-01-19 Thread Alan Gauld via Tutor
On 19/01/17 02:29, Sarika Shrivastava wrote: > Yes I dont have issue with unittest framework but i dont have to reconized > my issue How can I resolve this issue ?? What is the issue? You haven't told us what is wrong. What happens? What did you expect to happen? Are there any error messages? If

Re: [Tutor] How can we learn to use Python

2017-01-18 Thread Alan Gauld via Tutor
On 18/01/17 02:36, Laura Meldrum wrote: > www.sololearn.com/Play/Python/hoc says to "download the Python 3.x version > that is compatible with your operating system" So the first question is - what is your operating system? Assuming it is a version of Windows then you next need to find out

Re: [Tutor] Searching db while typing on Entry widget

2017-01-16 Thread Alan Gauld via Tutor
On 16/01/17 15:11, Ali Moradi wrote: > Hi. i want to search one field of my db while i type text in my Entry > widget. how can i do that? Assuming you mean a live search type of thing, like Google etc do then you need to bind the keypress (or maybe the key-up) event to a function that does the

Re: [Tutor] problem with scroll in Tkinter

2017-01-13 Thread Alan Gauld via Tutor
On 13/01/17 06:55, Ali Moradi wrote: > https://paste.pound-python.org/show/CIKA8eOFbdq18r3nFUBv/ > > On Fri, Jan 13, 2017 at 10:25 AM, Ali Moradi wrote: > >> hi. I've written this code and i can't fix the scrollbar error. i am a >> beginner in Python plz help. this is

Re: [Tutor] Convert tuple within tuple into single tuple

2017-01-11 Thread Alan Gauld via Tutor
On 11/01/17 06:31, ramakrishna reddy wrote: > Hi All, > > Is there any way to convert x = (1, 2, 3, (4, 5)) to x = (1, 2, 3, 4, 5) in > python 2.7 You can write a function(*) to flatten the data structure, but you need to be careful and think through how you expect it to handle strings, say...

Re: [Tutor] Importing classes

2017-01-11 Thread Alan Gauld via Tutor
On 11/01/17 02:53, kay Cee wrote: > Is there a proper way to import a class from a module? If so, please tell. The most common way is probably: >>> from mymodule import Myclass >>> myobject = Myclass() but its just as good to do >>> import mymodule >>> myobject = mymodule.Myclass() --

Re: [Tutor] small remark

2017-01-11 Thread Alan Gauld via Tutor
On 10/01/17 17:56, adil gourinda wrote: >When I was surfing in “Python Library” I made some observations and I want > to share them That's good and as a place to discuss those observations the tutor list is a suitable forum. However, if you want the proposals considered for actual

Re: [Tutor] Challenges with psycopg2 on Python 3.2

2017-01-06 Thread Alan Gauld via Tutor
On 06/01/17 12:55, Admire Mutsikiwa wrote: > it screams on the Python3.2 prompt, it gives Hardly screaming, rather a polite complaint that you've messed up your indentation. import psycopg2 > File "", line 1 > import psycopg2 > ^ > IndentationError: unexpected indent I'll guess

Re: [Tutor] Help with a Conversion

2017-01-05 Thread Alan Gauld via Tutor
On 05/01/17 13:29, S. P. Molnar wrote: > Fortran II using punched paper tape. Yes, am a rather elderly . . .). You are not the only one, there are at least 2 more of us on this list that started in that era... > short program to change frequency to wavelength for a plot of > ultraviolet

Re: [Tutor] prenting a line form appearing in log file

2017-01-05 Thread Alan Gauld via Tutor
On 05/01/17 13:01, anatta anatta wrote: > I have created a log file, using 'logging' module, > name = raw_input ("Please enter your name.") > print 'Hi ', name, 'Please go ahead and press enter to transfer files' > > The log file records the variable 'name' in the log file at the > right

Re: [Tutor] Total newbie question

2017-01-04 Thread Alan Gauld via Tutor
On 04/01/17 06:51, MR ZenWiz wrote: > It appears that while python is installed in /usr/bin, idle is in > /usr/local/bin and expects the python interpreter to be also under > /usr/local, which does not seem to be the default. > > I created a symlink 'ln -s /usr/bin/python3.5 >

Re: [Tutor] Fw: path string

2017-01-04 Thread Alan Gauld via Tutor
On 03/01/17 15:59, anatta anatta wrote: > Please disregard my request below. > > I know the problem! > > I have not defined the variable in question as a global variable. That's one solution but its not a very good one. Global variables are not considered good practice for many reasons. In

Re: [Tutor] Total newbie question

2017-01-03 Thread Alan Gauld via Tutor
On 03/01/17 01:21, MR ZenWiz wrote: > I'm trying to install python 4.6 on my Xubuntu 16.04 desktop, I assume you mean Python 3.6? And my first question is why? Do you have some specific features in 3.6 that you need? Otherwise just go with the latest version in your package manager which will

Re: [Tutor] path string

2017-01-02 Thread Alan Gauld via Tutor
On 02/01/17 17:01, anatta anatta wrote: > I am trying to create unsuccessfully source path as > a string 'str7' in part_1 of the code below, When you say unsuccessfully what do you mean? What do you expect? What do you get? > to be used in part_2 of the code. For that you need to expose it

Re: [Tutor] help :making window

2016-12-31 Thread Alan Gauld via Tutor
On 31/12/16 16:05, syafiqah amir via Tutor wrote: > Hello,Im trying to execute the code but the window does not come out. Please always post python code in plain text, otherwise the html gets wrapped and it becomes illegible. > (script from Maya python for games and film) This group is for

Re: [Tutor] formatting xml (again)

2016-12-27 Thread Alan Gauld via Tutor
On 27/12/16 19:44, richard kappler wrote: > Using python 2.7 - I have a large log file we recorded of streamed xml data > that I now need to feed into another app for stress testing. The problem is > the data comes in 2 formats. > > 1. each 'event' is a full set of xml data with opening and

Re: [Tutor] IndexError: list index out of range

2016-12-27 Thread Alan Gauld via Tutor
On 27/12/16 15:22, Mysore Ventaka Rama Kumar wrote: > Please review and comment/correct my error! Rather than expect us to read through many lines of code it would help id you posted the entire error message which will tell us exactly where the problem lies. Also tell us for completeness which

Re: [Tutor] How to interact with the result of subprocess.call()

2016-12-26 Thread Alan Gauld via Tutor
On 25/12/16 16:33, Jim Byrnes wrote: >> (*)LO remembers its last screen setting and opens with them, >> if those screen settings are different than the ones you >> programmed for then navigation will be different and so on. > > I don't think I need to "know where stuff is" to manipulate LO. It

Re: [Tutor] Manipulating Dictionary values

2016-12-26 Thread Alan Gauld via Tutor
On 26/12/16 08:03, Sunil Tech wrote: > Hi Team, > > Dictionary is like > > a = {'a': 'New', 'b': 'Two', 'l': [{'k': 'test', 'm': 'again'}, {'k': > 'test', 'm': 'again'}]} > > I am trying to modify a value in the dictionary value at a['l'] So make life easy for yourself and get rid of the outer

Re: [Tutor] accessing attribute from python programming for absolute beginner

2016-12-26 Thread Alan Gauld via Tutor
On 26/12/16 04:08, syafiqah amir via Tutor wrote: > i did not achieve the desired outcome which is the name of the critters did > not print > #attribute Critter#Demonstrates creating and accessing object attributes > class Critter(object):"""A virtual pet"""def __init__(self,name):

Re: [Tutor] How to interact with the result of subprocess.call()

2016-12-25 Thread Alan Gauld via Tutor
On 25/12/16 17:08, boB Stepp wrote: > Then I see that I have a GCE (Gross Conceptual Error) floating around. > I thought that event loops are just intercepting the redirected stdin > from the keyboard. This is not true? If not, then how is this > working? No event loops don't use stdin. They

Re: [Tutor] How to interact with the result of subprocess.call()

2016-12-25 Thread Alan Gauld via Tutor
On 25/12/16 01:58, boB Stepp wrote: > the stdin option of call()might be used to direct the desired > keystrokes to LO? After looking at The problem is that keystrokes in a GUI are not read from stdin, they are read as events from the GUI event loop. So, if LO was a CLI tool (like vim or top,

Re: [Tutor] How to interact with the result of subprocess.call()

2016-12-24 Thread Alan Gauld via Tutor
On 25/12/16 01:21, Jim Byrnes wrote: > I am not trying to automate libreoffice using subprocess. No, but you are trying to automate LO from within Python by sending it keystrokes and that's not easy. That's why I previously asked whether you really wanted to open the LO file directly and

Re: [Tutor] I download package and it says computer is missing this file, how do I fix?

2016-12-23 Thread Alan Gauld via Tutor
On 23/12/16 01:47, Don Pryor wrote: > [image: Inline image 1] > This is a text mailing list so the server strips out most attachments. You need to tell us a lot more. 1) What package are you trying to install 2) How are you downloading/installing it(pip/ftp/binary installer?) 3) Which OS and

Re: [Tutor] Trouble Launching Python

2016-12-22 Thread Alan Gauld via Tutor
On 19/12/16 22:38, Joseph Olugbohunmi via Tutor wrote: > Hello,Good day, I installed Python 3.5.2 on my Windows 8.1 PC Are you sure you used the right Python version. There are separate downloads for 32 and 64 bit machines. It may be that you downloaded the 64 bit version and have a 32bit OS

Re: [Tutor] Open a libreoffice calc file in Python

2016-12-22 Thread Alan Gauld via Tutor
On 22/12/16 03:37, Jim Byrnes wrote: > Python 3.4 on Ubuntu > > If I was going to open a libreoffice calc file from the terminal I would > go: libreoffice --calc /home/path/to/myfile.ods. > > How would I do this from Python? Others have advised how to run the Libreoffice app from within

Re: [Tutor] Using Python to solve factoria

2016-12-22 Thread Alan Gauld via Tutor
On 21/12/16 07:50, Hedgar wrote: > I really happy to be accepted to the list! You're welcome, but one very important thing to note is that you should always post to this list in plain text, not HTML. That's because HTML loses the formatting of the code (see below) and in Python formatting is

Re: [Tutor] Fwd: Question about selenium with python

2016-12-22 Thread Alan Gauld via Tutor
On 21/12/16 01:29, Fazal Khan wrote: > Im a new programmer and this is my first time posting here. I have a > question about using selenium with python. I notice you haven't had an answer yet. That may be because Selenium is not part of the standard Python library and this list is for questions

Re: [Tutor] function argument unpacking

2016-12-08 Thread Alan Gauld via Tutor
On 08/12/16 06:04, Palanikumar wrote: > #Function Argument unpacking > def myfunc(x, y, z): > print(x. v. z) > Please always send the actual code that generates the error, do not retype as it causes us to chase phantom bugs. In this case the fact that the v in the print statement should be

Re: [Tutor] copy files selectively from source to destination

2016-12-05 Thread Alan Gauld via Tutor
On 05/12/16 16:20, anatta anatta wrote: > I however want to copy selective files. > For example I like to copy only .txt files only > How could I do this selective copying? By applying an if test just before you copy filetype = '.txt' # or read it as an input ... if sourcefile extension

Re: [Tutor] Ran into a problem: Tried many different methods

2016-11-30 Thread Alan Gauld via Tutor
On 30/11/16 02:29, Parish Watteau wrote: > A program that will read each player’s name and golf score as > keyboard input, and then save these as records in a file named golf.txt. > (Each record will have a field for the player’s name and a field for the > player’s score.) > > I attempted

Re: [Tutor] Help on Software Design decisions

2016-11-29 Thread Alan Gauld via Tutor
On 29/11/16 02:02, Juan C. wrote: >>> I have to build my own Moodle API to be consumed by my program, I just noticed the last bit. Is this a client side API or a server side API? In other words are you building a set of services on the server or are you building a module that makes it easy for

Re: [Tutor] Help on Software Design decisions

2016-11-28 Thread Alan Gauld via Tutor
On 28/11/16 21:53, Juan C. wrote: > I'm a student and my university uses Moodle as their learning management > system (LMS). Never heard of it but hopefully that doesn't matter :-) > 1. Bachelor's Degree in Computer Science (duration: 8 semesters) > > 1.1. Unit 01: Mathematics Fundamental

Re: [Tutor] how to move an executable into path

2016-11-27 Thread Alan Gauld via Tutor
On 23/11/16 00:33, Benjamin Fishbein wrote: > I should probably learn how to handle paths and file systems, etc., You definitely should if you intend doing any serious programming on MacOS. Learn to drive the Terminal tool and the basic Unix command line tools and you will have much more

Re: [Tutor] Help with Python Queue

2016-11-26 Thread Alan Gauld via Tutor
On 26/11/16 09:07, anish singh wrote: > I have below code but it is giving this error: > AttributeError: Queue instance has no attribute 'taskdone' Please post the full error not just a summary. Also please post the actual code... > import threading > from Queue import Queue I get an import

Re: [Tutor] inquiry

2016-11-26 Thread Alan Gauld via Tutor
On 26/11/16 04:59, zxjhust1 wrote: > Dear tutors: >I have some questions about memory mechanism of python. Depending on the level of detail you need this might be more appropriate to the general Python list. Implementation details are usually a bit too advanced for most readers of tutor.

Re: [Tutor] Python code

2016-11-24 Thread Alan Gauld via Tutor
On 24/11/16 23:14, urfa jamil wrote: > I need help to write a code for this problem. > > Please help OK, But what exactly do you want help with? Have you written any code yet? If so show us. Also if you get an error message post it. > Ask the user to enter a series of numbers. Can you do this

Re: [Tutor] __getitem__

2016-11-23 Thread Alan Gauld via Tutor
On 23/11/16 12:25, monik...@netzero.net wrote: > I have two questions in regards to below code: > 1. largest is a list, not a list of lists. > [('deit', 4), ('acer', 3), ('aceilmr', 2), ('arst', 2)] > so why when I do largest[0] I get the whole list again, I don't know you will need to show us

Re: [Tutor] __getitem__ another problem

2016-11-23 Thread Alan Gauld via Tutor
On 23/11/16 12:33, monik...@netzero.net wrote: > So numbermap.__getitem__ brings back 1, then 2,then 3, then 4. > Then it looks up 1 ,2, 3, 4 in month but there is no key with value 1, 2, or > or in 4. > What am I missing? Your problem is not with getitem but with sorted. You need to read up

Re: [Tutor] __getitem__ another problem

2016-11-23 Thread Alan Gauld via Tutor
On 23/11/16 06:26, monik...@netzero.net wrote: > I do not understand how numbermap.__getitem__ brings back month's key. numbermap returns the integer corresponding to the key. That number is then used by sorted as the basis for sorting month. So for the first entry sorted receives the value 1,

Re: [Tutor] __getitem__

2016-11-23 Thread Alan Gauld via Tutor
On 23/11/16 06:09, monik...@netzero.net wrote: > Can you please explain __getitem__? __getitem__ is the operator overload for indexing. It is like the __add__() method which overloads the + operator. So if you imple,ent __add__() in your class you can add two instances together using + and

Re: [Tutor] Python Help

2016-11-16 Thread Alan Gauld via Tutor
On 16/11/16 22:51, Omari Lamar wrote: > I am looking for assistance with the python language. Can you send out an > eblast asking that if anyone can offer 1 on 1 assistance via skype to cover > the basics that would be greatly appreciated. Further to Bens message, we don't offer private 1-1

Re: [Tutor] please help me with after method

2016-11-16 Thread Alan Gauld via Tutor
On 16/11/16 18:48, Freedom Peacemaker wrote: > Hi, i need help. I am using Python 3.4 and I have wrote little app for > windows only ( windows 7 and higher). Its timer and my app working but not > good. Some people said that i should use after method instead of update() after() executes a

[Tutor] Please ignore: just testing

2016-11-15 Thread Alan Gauld via Tutor
The group seems unusually quiet so I'm just testing the server is working ok -- 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 Flickr at: http://www.flickr.com/photos/alangauldphotos

<    6   7   8   9   10   11   12   13   14   15   >