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

2016-12-21 Thread cs
On 21Dec2016 21:54, boB Stepp wrote: On Wed, Dec 21, 2016 at 9:37 PM, 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? My first thought was: impo

Re: [Tutor] sumHighest function help

2016-11-04 Thread cs
Interesting. Tracey Jones has a very similar question... - Cameron Simpson On 04Nov2016 16:44, Lloyd Francis wrote: Hi, I want to write a function that will calculate and return the sum of the *n* highest value in a list *a. *Also, when n is less than 0, the answer should be zero, and if n is

Re: [Tutor] implementing sed - termination error

2016-11-01 Thread cs
On 01Nov2016 20:18, bruce wrote: Running a test on a linux box, with python. Trying to do a search/replace over a file, for a given string, and replacing the string with a chunk of text that has multiple lines. From the cmdline, using sed, no prob. however, implementing sed, runs into issues, t

Re: [Tutor] beautifulsoup

2016-10-03 Thread cs
On 04Oct2016 13:35, Crusier wrote: I am trying to scrap from the (span class= 'Number'). The code looks like this on the pages I am scrapping: 99 10.00(-0.1%) Menu Max Quantity 100.000 Average Quantity 822 Previous Order 96 Max Price 104 Number of Trades 383

Re: [Tutor] project directory structure

2016-08-27 Thread cs
On 27Aug2016 09:06, Alex Kleider wrote: On 2016-08-26 21:58, Ben Finney wrote: Alex Kleider writes: Am I to assume that if I have activated a virtualenv, then the following shebang #!/usr/bin/env python will use the python specified in the venv/bin/? Yes, the purpose of that shebang is to t

Re: [Tutor] How to use function with default values ?

2016-08-07 Thread cs
On 07Aug2016 09:19, Alan Gauld wrote: On 07/08/16 04:22, rishabh mittal wrote: I am new to python and come from C language background. I couldn't able to understand this >>> def f(a, L=[]): ... L.append(a) ... return L print(f(1)) [1] print(f(2)) [1, 2] [...] In the first example

Re: [Tutor] Best way to do FTP login?

2016-06-17 Thread cs
On 17Jun2016 19:07, Michael Selik wrote: On Fri, Jun 17, 2016 at 12:46 PM boB Stepp wrote: ftp = FTP('ip_address', 'username', 'password') Or ftp = FTP('ip_address') ftp.login('username', 'password') Most of the examples I am seeing online use the second approach. Is there some reason why

Re: [Tutor] Loop blocks

2016-06-11 Thread cs
On 10Jun2016 22:41, Jignesh Sutar wrote: Is there a better way to code the below than to specify blocks as I have. Ideally I'd like to specify blocks simply as *blocks=(12,20,35)* blocks=[(1,12), (13,20), (25,35)] for i,j in enumerate(blocks): for x in xrange(blocks[i][0],blocks[i][1]+1):

Re: [Tutor] Python 3: string to decimal conversion

2016-05-23 Thread cs
On 23May2016 12:18, Saidov wrote: Thanks everyone for all your help. This solved my problem with parenthesis and $ signs in the data: if not row[4]: pass else: try: expenses[ts.Date(row[0]).month] += decimal.Decimal(row

Re: [Tutor] Python 3: string to decimal conversion

2016-05-22 Thread cs
On 22May2016 08:19, Saidov wrote: Thank you all for the useful feedback. I am new to programming so bear with me while I learn the rules... I have run Cameron's code to print the values and have the traceback results. please see below. [...] for row in records: [...]

Re: [Tutor] Python 3: string to decimal conversion

2016-05-21 Thread cs
Hi Saidov, I'm going to reply to your post inline, as that is the etiquette here and in many technical mailing lists. On 21May2016 13:34, Saidov wrote: I am working on a piece of python code that's supposed to help me manage a budget: 1. Read a banking statement 2. Categorize expenses and in

Re: [Tutor] Adding to a dict through a for loop confusion.

2016-05-17 Thread cs
On 17May2016 04:28, Chris Kavanagh wrote: Could someone tell me why this different behavior occurs between these 2 code snippets, please. The 1st example has quotes around it ['item'] only adds the last item to the dict (cart). In the 2nd example the item does not have quotes around it [item] an

Re: [Tutor] Behavior of dictionary in mapping keys that evaluate equal

2016-05-11 Thread cs
On 11May2016 14:00, khalil zakaria Zemmoura wrote: Suppose we have a dict Dic = { True: 'yes', 1: 'No'} According to the Python 3 documentation, the keys must have a unique value so True is converted to integer because of the type coercion (boolean are subtype of integer) so boolean are winded

Re: [Tutor] Dictionary Question

2016-05-02 Thread cs
On 03May2016 00:56, Jason N. wrote: Thank you all for your responses.  A quick follow up, what is the best way to make dictionary requests case in-sensitive? For example, "Apple and "apple" should bring back the same dictionary response. Thank you. There are a few ways depending what your mo

Re: [Tutor] META: Moderation and subscription to the tutor list

2016-04-30 Thread cs
On 01May2016 14:18, Steven D'Aprano wrote: Hi Alan, I thought I'd mention that the list-owners of "python-list" have now decided to only allow people to post if they are subscribed to the list: https://mail.python.org/pipermail/python-list/2016-April/707571.html The motivation is to ensure th

[Tutor] Weave - how to find the compiler on windows

2011-01-24 Thread CS
Hello! I want to use weave.biltz(), but it doesn´t find the compiler. I installed minGW on windows in the path C:\MinGW\bin (so no spaces here) and added it to the path variable (and it works on the command line). I already installed python and scipy. Okay, now the question : How do I tell sci