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

2017-01-11 Thread Emile van Sebille
On 01/10/2017 10:31 PM, 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 Almost: # /usr/bin/env python Python 2.7.3 (default, Sep 22 2012, 02:37:18) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" f

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

2016-12-05 Thread Emile van Sebille
On 12/05/2016 08:20 AM, anatta anatta wrote: Dear tutor! Here is my working code - to copy files from one drive to another. I however want to copy selective files. For example I like to copy only .txt files only from the source to destination, and not other types of files. How could I do t

Re: [Tutor] Convert structured 1D array to 2D array

2016-02-27 Thread Emile van Sebille
On 2/26/2016 7:26 PM, Ek Esawi wrote: The result i am looking for is a 2D array (matrix) instead of 1D array of tuples. That's when i read a file using genfromtxt, it generated a 1D array of n tuples (like the example shown below); each tuple has one row from the original file. The file contains

Re: [Tutor] No connection could be made because the target machine actively refused it (despite mongod running) and unable to insert data into MongoDB

2016-01-22 Thread Emile van Sebille
On 1/21/2016 2:06 PM, Arjun Srivatsa wrote: Hello everyone, I have been trying to insert data (a 'hello world' string) from PLC into MongoDB using Python API (which pulls the data from PLC and pushes it into MongoDB). I have been getting the error message '*line 222, in meth return getattr(self

Re: [Tutor] how to invert tuples, one problem more

2015-11-30 Thread Emile van Sebille
On 11/27/2015 12:50 PM, marcus lütolf wrote: dear pythonistas, thanks for your very valuable help. I am struggling with a simple piece of code: x = Marcus print '{0} {1} x'.format('a', '=') You're almost there - print '{0} {1} {2}'.format('a', '=', x) Emile which gives me a = x instea

Re: [Tutor] Working collaboratively

2015-10-19 Thread Emile van Sebille
On 10/19/2015 3:04 PM, Alex Kleider wrote: On 2015-10-19 13:08, Emile van Sebille wrote: This looks like the list of identified issues: https://bitbucket.org/pypa/pypi/issues Browse through and see if anything looks interesting/doable. On 2015-10-19 13:34, Mark Lawrence wrote: How

Re: [Tutor] Working collaboratively

2015-10-19 Thread Emile van Sebille
On 10/19/2015 12:53 PM, Alex Kleider wrote: On 2015-10-19 12:37, Ben Finney wrote: So, while it's not essential, I would heartily encourage you to pick some of the PyPI projects you are enjoying, or want to improve, and contact their maintainers with your offer to fix specific things. Work wit

Re: [Tutor] File operation query

2015-10-15 Thread Emile van Sebille
On 10/15/2015 9:00 AM, Reuben wrote: Hi All, I need some clarification for below code. In line 2 of below code snippet, I have provided read and write permission. Assuming I have provided some string input as requested in line 1 - when I try to open "check.txt" file after running the script, it

Re: [Tutor] File operation query

2015-10-15 Thread Emile van Sebille
On 10/15/2015 9:00 AM, Reuben wrote: Hi All, I need some clarification for below code. In line 2 of below code snippet, I have provided read and write permission. Assuming I have provided some string input as requested in line 1 - when I try to open "check.txt" file after running the script, it

Re: [Tutor] 0 > "0" --> is there a "from __future__ import to make this raise a TypeError?

2015-10-12 Thread Emile van Sebille
On 10/12/2015 9:12 AM, Albert-Jan Roskam wrote: Hi, In Python 2 one can do silly apple-pear comparisons such as 0> "0".*) "CPython implementation detail: Objects of different types except numbers are ordered by their type names; objects of the same types that don’t support proper comparison a

Re: [Tutor] Can one use python to concatenate n media files?

2015-10-12 Thread Emile van Sebille
On 10/11/2015 9:15 PM, Fast Primes wrote: If so, could someone present an example? target = open(target,'wb') for source in mediafilelist: target.write(open(source,'rb').read()) But you probably want something different anyway. Emile ___ Tu

Re: [Tutor] Updating index of a list

2015-10-08 Thread Emile van Sebille
On 10/8/2015 12:40 PM, Andrea Nguy wrote: Hi there, I’m trying to learn some Python programming on my own. What’s happening is that I am trying to take a list of a list as such: [['1', ' james', ' 1', ' 90'], ['2', ' alice', ' 1', ' 95'], ['5', ' jorgen', ' 1', ' 99’]] (it continues) from a

Re: [Tutor] Creating a match file

2015-09-21 Thread Emile van Sebille
On 9/20/2015 12:19 PM, EILEEN CHURCH CARSON wrote: I want to write a program that reads in data from two csv files with 6 columns each. I want it to determines if the data in the first two columns is the same, and if so read all six columns in that line from each of the two files into a 12 colum

Re: [Tutor] Invalid Syntax Message

2015-09-14 Thread Emile van Sebille
On 9/14/2015 2:50 PM, Shannon Rodenbeck wrote: I have downloaded Python 3.4.3 on my Mac 10.10.4. When i try running my programs from IDLE to go on Shell i get the message that says "Invalid Syntax". I've tried my programs on a different windows computer and it runs and works perfectly. How do I f

Re: [Tutor] problem with code

2015-08-20 Thread Emile van Sebille
On 8/20/2015 2:50 AM, Nathan Clark wrote: I have written a basic program out of python and it is not functioning, please could you proof read my code and tell me how to fix it.It is in python 3.3 time=int(input("How long on average do you spend on the computer per day?") (print("that seems reaso

Re: [Tutor] About using list in a function

2015-08-19 Thread Emile van Sebille
On 8/19/2015 11:20 AM, Marc Tompkins wrote: (Every couple of weeks, despite my repeated attempts to stop TBird from auto-updating, I find that they've got a new version and can't connect. Fortunately Mozilla hasn't changed their DB format, so I can just re-install 33.) Anyway, I know why _they_

Re: [Tutor] variable existence q

2015-08-15 Thread Emile van Sebille
On 8/15/2015 3:38 PM, Clayton Kirkwood wrote: top_directory = "/users/Clayton/Pictures" target_directory = top_directory #directory we are checking filetypes = ('jpg', 'png', 'avi', 'mp4', 'mov', 'bmp') imports... def override_defaults(): with open( user_preferences ) as f: f

Re: [Tutor] variable existence q

2015-08-15 Thread Emile van Sebille
On 8/15/2015 2:47 PM, Mark Lawrence wrote: On 15/08/2015 22:11, Peter Otten wrote: Clayton Kirkwood wrote: 10 top_directory = "/users/Clayton/Pictures" def override_defaults(): 56 return( top_directory, filetypes, target_directory ) 80 top_directory, filetypes, target_directory = ov

Re: [Tutor] SQLite, Python and SQL injection attacks

2015-08-14 Thread Emile van Sebille
On 8/14/2015 11:40 AM, boB Stepp wrote: I was just looking at the sqlite3 docs at https://docs.python.org/3/library/sqlite3.html?highlight=sqlite#module-sqlite3 and found the following cheery news: "Usually your SQL operations will need to use values from Python variables. You shouldn’t assemb

Re: [Tutor] revisiting a puzzle about -3**2 vs (-3)**2

2015-08-12 Thread Emile van Sebille
On 8/12/2015 9:07 AM, D Wyatt wrote: so I 'get' that -5**2 = -25 and (-5)**2 is 25, BUT if you write a function def sq(x): """ Output: sq returns the square of its input input x: a number (int or float) """ return x**2 and pass it a negative number it handles it as though the ar

Re: [Tutor] Help

2015-08-10 Thread Emile van Sebille
On 8/10/2015 10:07 AM, Alan Gauld wrote: PS. What is SDSU? San Diego State University I'd guess. Emile ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] DEALING WITH API

2015-08-07 Thread Emile van Sebille
On 8/7/2015 2:14 AM, Gaurav Lathwal wrote: Hello everyone. :)) This time I am trying to fetch the required data using the API of the website. But, the problem I am having is I don't know how to make the request properly. When I enter the required URL in my browser, it downloads a .tgz which incl

Re: [Tutor] Dictionary Issue

2015-08-07 Thread Emile van Sebille
On 8/6/2015 5:30 PM, Ltc Hotspot wrote: I'm following the instructor's video exercise, available at https://www.youtube.com/watch?v=3cwXN5_3K6Q. As you're clearly interested in learning python, you may find working the tutorial beneficial as it steps you through the fundamentals of python i

Re: [Tutor] Schechter Function in python

2015-08-04 Thread Emile van Sebille
On 8/4/2015 3:16 PM, Michael Roberts via Tutor wrote: I'm having a few problems defining a Schecter function in python. Without going into too much detail I need to add a +0j factor for matplotlib to plot the function in real and imaginary space. I know that this is not what should be happenin

Re: [Tutor] scratching my head

2015-08-04 Thread Emile van Sebille
On 8/3/2015 1:22 AM, Cameron Simpson wrote: That depends. This is the tutor list; we're helping Clayton debug his code as an aid to learning. While it's good to know about the facilities in the standard library, pointing him directly at fnmatch (which I'd entirely forgotten) is the "give a man a

Re: [Tutor] String Attribute

2015-08-01 Thread Emile van Sebille
On 8/1/2015 4:21 PM, Ltc Hotspot wrote: Hi Emile, Question: What is the source of the line 7 syntax: mbox.split? I read mbox from the file. eg, mbox = open("mbox-short.txt",'r').read() and it looks to me that if you insert the above in front of the for loop below you'll get further. Emil

Re: [Tutor] String Attribute

2015-08-01 Thread Emile van Sebille
On 8/1/2015 4:07 PM, Ltc Hotspot wrote: Hi Alan, Question1: The output result is an address or line? It's a set actually. Ready to be further processed I imagine. Or to print out line by line if desired. Question2: Why are there 54 lines as compared to 27 line in the desired output? Be

Re: [Tutor] email validation

2015-08-01 Thread Emile van Sebille
On 8/1/2015 10:54 AM, Quiles, Stephanie wrote: Hello All, I have a python assignment. I have to make sure that when user inputs email that the program verifies that the address as a @ and a “.” in the entry or else return an invalid email error. A Very rudimentary form of email validation. i c

Re: [Tutor] String Attribute

2015-08-01 Thread Emile van Sebille
On 8/1/2015 12:00 PM, Ltc Hotspot wrote: Hi Everyone: Let me repost the question: You will parse the From line using split() and print out the second word in the line (i.e. the entire address of the person who sent the message). Then print out a count at the end. *Hint:* make sure not to incl

Re: [Tutor] a puzzle about -3**2 vs (-3)**2

2015-08-01 Thread Emile van Sebille
On 8/1/2015 9:43 AM, Steven D'Aprano wrote: The bottom line is, there is no universal right or wrong answer for the precedence rules for operators, although some rules are less right than others. My bottom line is that the liberal use of parens reconciles them all, particularly for any humans

Re: [Tutor] String Attribute

2015-08-01 Thread Emile van Sebille
Hi Hal, Seeing now that the output is only extracted from six address blocks, can you paste in the full contents of the file mbox-short.txt? (or the first 5-10 address sets if this is only representative) I think if we have a better understanding of the structure of the content you're parsin

Re: [Tutor] String Attribute

2015-07-31 Thread Emile van Sebille
On 7/31/2015 11:57 AM, ltc.hots...@gmail.com wrote: →Question: Why is the list index out of range on line # 9: IndexError Traceback (most recent call last) C:\Users\vm\Desktop\apps\docs\Python\assinment_8_5_v_20.py in () 7 line2 = line.strip() 8 line3 = line2.s

Re: [Tutor] 'open' is not defined

2015-07-30 Thread Emile van Sebille
On 7/30/2015 4:41 PM, ltc.hots...@gmail.com wrote: Hi Everyone: Why is open not defined in the following code:NameError: name 'open' is not defined Because of something you did previously. We don't have enough information to answer. open exists as a built-in function in python: Python 2

Re: [Tutor] Basic question about docstrings

2015-07-29 Thread Emile van Sebille
On 7/29/2015 8:45 AM, David Aldrich wrote: Hi If I have a script called main.py and document a function in it: def get_value(x): """ Some text ... :param x: Some value :returns: Something useful """ What is the most basic way of showing those docstrings at the

Re: [Tutor] Identifying V3 examples

2015-07-23 Thread Emile van Sebille
On 7/23/2015 5:08 PM, Alan Gauld wrote: On 23/07/15 19:50, Laura Creighton wrote: Also some people like to use the combination %< %< %< or >% >% >% A new one on me, but I kind of like it. ;-) I usually just use I include them generally to bracket code intended to be cut and paste into t

Re: [Tutor] FW: query

2015-06-24 Thread Emile van Sebille
On 6/24/2015 5:58 AM, abhijeet...@yahoo.in wrote: Hey guys can anybody tell me what's wrong with this code: The code is below? Actually the point is that when we put "34h4" type of value it's an valueerror but here no handling is been performed by the python ??? while 1: number=int(input("

Re: [Tutor] FW: query

2015-06-23 Thread Emile van Sebille
You're more likely to get an appropriate response if you review http://catb.org/~esr/faqs/smart-questions.html and then ask. Emile On 6/23/2015 10:13 AM, Gupta, Manaswini Kat wrote: From: Gupta, Manaswini Kat Sent: Tuesday, June 23, 2015 10:42 PM To: 'tutor-ow...@python.org' Subject: FW: qu

Re: [Tutor] ls *.py[co] >> .hidden

2015-05-21 Thread Emile van Sebille
On 5/21/2015 9:28 AM, Albert-Jan Roskam via Tutor wrote: I just created an alias for this: alias hidepycs="ls *.py[co] > .hidden" Close -- try alias ls='ls --hide=*.py[co]' and when you want to see them use ls -a. Emile ___ Tutor maillist - Tu

Re: [Tutor] pointer puzzlement

2015-05-07 Thread Emile van Sebille
On 5/7/2015 12:15 PM, Jim Mooney Py3.4.3winXP wrote: I find this a bit confusing. Since the ID of K remains the same, so it's the same object, why isn't it increasing each time. i.e, 20, 30, 40,. I understand that it's immutable but doesn't that mean K is created each time in local scope so it sh

Re: [Tutor] Why is it invalid syntax to have a particular dictionary value as an argument?

2015-04-07 Thread Emile van Sebille
On 4/6/2015 12:42 PM, Dave Angel wrote: On 04/06/2015 03:20 PM, Emile van Sebille wrote: Python 2.7.6 (default, Mar 22 2014, 22:59:56) [GCC 4.8.2] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> d = {

Re: [Tutor] Why is it invalid syntax to have a particular dictionary value as an argument?

2015-04-06 Thread Emile van Sebille
On 4/6/2015 7:54 AM, boB Stepp wrote: Python 2.7.8 (default, Jun 30 2014, 16:03:49) [MSC v.1500 32 bit (Intel)] on win32 Type "copyright", "credits" or "license()" for more information. d = {'n': 'Print me!'} d {'n': 'Print me!'} d['n'] 'Print me!' def func(d['n']): SyntaxError: invalid syn

Re: [Tutor] Matrix bug

2015-04-05 Thread Emile van Sebille
On 4/5/2015 7:12 AM, Narci Edson Venturini wrote: The next code has an unexpected result: a=3*[3*[0]] a now contains three references to the same object, hence the results you show below. You can create three distinct objects as follows: >>> a = [ [0,0,0] for i in (0,1,2) ] >>> a[1][1]=1

Re: [Tutor] Request review: A DSL for scraping a web page

2015-04-02 Thread Emile van Sebille
On 4/2/2015 4:22 AM, Dave Angel wrote: There was somewhere in one of the books a list of 'good practice,' including an item something like: Solve the right problem. There's a world of wisdom in that one alone. +1 Emile ___ Tutor maillist - Tuto

Re: [Tutor] updating a dictionary

2015-02-19 Thread Emile van Sebille
On 2/19/2015 3:10 PM, Alan Gauld wrote: On 19/02/15 22:50, Emile van Sebille wrote: if cell.endswith(suffix, 14, 16) is False: ... so they'll never end with numeric values. Further, "".endswith() accepts only one argument so you ought to get an error on this line. Sorr

Re: [Tutor] updating a dictionary

2015-02-19 Thread Emile van Sebille
On 2/19/2015 1:19 PM, Chris Stinemetz wrote: Hello List, I have a dictionary that I would like to update/add rows to it as I read a file line by line. The dictionary format looks like: format = {'Cell': '','7':'','8':'','9':'','2':''} For each line read in I would simply like to check to see

Re: [Tutor] (no subject)

2015-02-19 Thread Emile van Sebille
On 2/19/2015 9:23 AM, rakesh sharma wrote: Greetings !! Hi all, what the meaning of the line at the start of the python file __author__ = "user" Googling __author__ provides lots of relevant info. Emile ___ Tutor maillist - Tutor@python.org To

Re: [Tutor] Topic focus of ‘python-tutor’

2015-02-19 Thread Emile van Sebille
On 2/19/2015 1:51 AM, James Chapman wrote: No one should *_EVER_ *be discouraged to ask a question they do not know have not found the answer to. Learning where to look and how to ask are likely more important skills for a programmer than learning any one specific language. Emile

Re: [Tutor] Why is an instance smaller than the sum of its components?

2015-02-03 Thread Emile van Sebille
On 2/3/2015 1:12 PM, Jugurtha Hadjar wrote: Hello, I was writing something and thought: Since the class had some 'constants', and multiple instances would be created, I assume that each instance would have its own data. So this would mean duplication of the same constants? If so, I thought why n

Re: [Tutor] Learning python scripts for practical linux activities.

2015-01-15 Thread Emile van Sebille
On 1/15/2015 6:07 AM, dw wrote: Hello, I'm new the the group and new to programming in Python. I would like to find a source, book etc of Python learning projects. Projects that are useful for standard Linux activities like bulk renaming files, managing repository packages. Maybe python scrip

Re: [Tutor] Problem understanding the asarray function of numpy

2014-09-11 Thread Emile van Sebille
On 9/11/2014 6:34 AM, Radhika Gaonkar wrote: I have an implementation of lsa, that I need to modify. I am having some trouble understanding the code. This is the line where I am stuck: DocsPerWord = sum(asarray(self.A > 0, 'i'), axis=1) Python doesn't provide an axis parameter for the sum buil

Re: [Tutor] How to count vehicle? I'm trying but my code don't increasing..

2014-09-03 Thread Emile van Sebille
On 9/2/2014 7:01 AM, Whees Northbee wrote: If all of these confusing, I'll simplify the problem, I need to know if a point (x,y) exactly at a line where line is (ax1,ay) to (ax2,ay).. Can someone tell me how?? if ax1https://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Shorter way for a little program

2014-08-24 Thread Emile van Sebille
On 8/23/2014 7:16 AM, Mimi Ou Yang wrote: age = input("K") age = int(age) if (age == 1) or (age == 2) or (age == 3) or (age == 4): print ("LOL") else: print ("K") Is there a shorter way to do this program??? print ('LOL','K')[int(input("k"))>4] ___

Re: [Tutor] import values, calculate distance

2014-08-21 Thread Emile van Sebille
On 8/21/2014 6:13 AM, Joel Goldstick wrote:> On Wed, Aug 20, 2014 at 10:12 PM, LN A-go-go > wrote: > while you can name things like this, good python style (look up > 'pep8') says this would be better > id_code, x_coordinate, y_coordinate > > But better yet, I think would be to call these thing

Re: [Tutor] import values, calculate distance

2014-08-21 Thread Emile van Sebille
On 8/21/2014 6:13 AM, Joel Goldstick wrote:> On Wed, Aug 20, 2014 at 10:12 PM, LN A-go-go > wrote: > while you can name things like this, good python style (look up > 'pep8') says this would be better > id_code, x_coordinate, y_coordinate > > But better yet, I think would be to call these thing

Re: [Tutor] Using subprocess on a series of files with spaces

2014-07-31 Thread Emile van Sebille
On 7/31/2014 12:53 PM, C Smith wrote: I am on OSX, which needs to escape spaces in filenames with a backslash. There are multiple files within one directory that all have the same structure, one or more characters with zero or more spaces in the filename, like this: 3 Song Title XYZ.flac. I want

Re: [Tutor] Read a file, Load a dictionary

2014-07-24 Thread Emile van Sebille
On 7/24/2014 3:50 PM, Glenn Lester wrote: I have been looking around for a way to read a comma delimited csv file start with the csv module. http://www.python.org/doc/current/lib/module-csv.html DESCRIPTION This module provides classes that assist in the reading and writing of Co

Re: [Tutor] Security and Reliability of Python

2014-07-24 Thread Emile van Sebille
On 7/24/2014 3:11 AM, Allahondoum Mbaibarem wrote: I'm new at python and I would like to have knowledge about the Security and the Reliability factor of Python thank you. That's a pretty open-ended question. It's as secure and reliable as what you write. For most of us, it's as secure and r

Re: [Tutor] subprocess.call not formatting date

2014-07-08 Thread Emile van Sebille
On 7/8/2014 9:44 AM, Bob Williams wrote: -BEGIN PGP SIGNED MESSAGE- Hash: SHA1 I'm using Python 2.7.6 on an openSUSE linux system. I'm trying to convert a shell (bash) script to a python script, and everything's worked OK except this. The following line in the shell script btrfs subvo

Re: [Tutor] Python Socket Error: Connection refused

2014-07-07 Thread Emile van Sebille
On 7/7/2014 10:16 AM, Matthew Ngaha wrote: On Mon, Jul 7, 2014 at 12:55 PM, Dave Angel wrote: You will want to configure your DOS Box to make it easier to cut and paste. How is this done? I'm not on windows atm to test it. I think it's referring to the two edit options on the options tab

Re: [Tutor] Why is Quick Search at docs.Python.org so useless?

2014-07-06 Thread Emile van Sebille
On 7/5/2014 11:40 AM, Deb Wyatt wrote: I'd be using a news reader if accessing news was still free. Try news.gmane.org. Emile ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/lis

Re: [Tutor] What are your favourite unofficial resources

2014-06-30 Thread Emile van Sebille
On 6/30/2014 4:14 PM, Danny Yoo wrote: In any event, I did very much like Dave Beazley's "Python Essential Reference". At least, I remember thinking it was excellent it when it was in its red cover. :P I don't know what the latest edition is like, but it's probably of similar quality. Well

Re: [Tutor] What are your favourite unofficial resources

2014-06-30 Thread Emile van Sebille
On 6/30/2014 3:48 PM, Danny Yoo wrote: What are the best unofficial (ie not python.org) resources for people who have learned the basics but are not experts yet? dejanews.com, no wait, that's now groups.google.com -- oh wait, the just-don't-be-evil empire kinda killed that one off finally. >s

Re: [Tutor] What are your favourite unofficial resources

2014-06-30 Thread Emile van Sebille
On 6/29/2014 3:41 PM, Alan Gauld wrote: What are the best unofficial (ie not python.org) resources for people who have learned the basics but are not experts yet? dejanews.com, no wait, that's now groups.google.com -- oh wait, the just-don't-be-evil empire kinda killed that one off finally.

Re: [Tutor] How does one construct a module for import?

2014-06-02 Thread Emile van Sebille
On 6/2/2014 5:21 AM, Sydney Shall wrote: I am having a similar problem. However, when I use the import statement in my program I get a runtime error as follows: in () > 1 CapitalSimulation(51, 4000.0, 20.0, 20.0, 100, 1.0, 0.0, 40.0, 1.0) /Users/sydney/My_Documents/Political_Economy/C

Re: [Tutor] (no subject)

2014-05-15 Thread Emile van Sebille
On 5/14/2014 9:57 PM, JEAN MICHEL wrote: def calcaverage(test1,test2,test3): for count in range(test1,test2,test3): curraverage=0 curraverage=((test1[count]+ test2[count]+ test3[count])/3) currentaverage.append(curraverage) if curraverage>= 90:

Re: [Tutor] Finding Hostname-IP DNS mappings and if machine is dead or alive

2014-05-12 Thread Emile van Sebille
How far have you gotten? Post your code to show us where you're at and we can point you in the right direction. Emile On 5/12/2014 2:44 PM, KIRAN D.S. wrote: Hi, I have a UNIX shell script that: a. lists out the Hostname-IP DNS mappings b. checks whether the machine is pingable, and print

Re: [Tutor] Keeping change-in-place vs. copy methods straight

2014-04-28 Thread Emile van Sebille
On 4/28/2014 11:45 AM, taserian wrote: Is there some sort of rule-of-thumb to determine if a function is in-place or returns a value? my rule of thumb is to ask: Python 2.7.5 (default, May 15 2013, 22:44:16) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits" or "license

Re: [Tutor] Understanding code line

2014-03-27 Thread Emile van Sebille
On 3/21/2014 3:40 PM, Steven D'Aprano wrote: a = b This assigns the value to b. So if b was 4, now a is also 4. Steven means 'assigns the value to a' here. For anyone looking down the line... ___ Tutor maillist - Tutor@python.org To uns

Re: [Tutor] PLEASE remove me from your e-mailing list

2014-03-20 Thread Emile van Sebille
We can't take you off the list -- see the line below that says: To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor Emile On 3/20/2014 3:43 PM, Art Caton wrote: artca...@gmail.com no longer requests your "Tutor Request" e-mailings ___

Re: [Tutor] How to determine which function code is being called from

2014-03-06 Thread Emile van Sebille
While there are ways of getting at the caller using introspection, there are no reliable ways of doing so and you would do well to rethink the need and take an alternate course such as passing a parameter in. Suppose the following: funcC=funcB what would you want to see? Emile On 3/6/2014

Re: [Tutor] reg: How to import dll in python

2014-03-05 Thread Emile van Sebille
Hi Shweta, You'll likely get a better response posting this question on the main python list -- the Tutor list is primarily for teaching python Emile On 3/5/2014 4:49 AM, Shweta Kaushik wrote: Hi, Please find code used to create dll: *_add_1.cpp_* #include "add_1.h" using namespace std;

Re: [Tutor] Regular expression - I

2014-02-18 Thread Emile van Sebille
On 2/18/2014 11:42 AM, Mark Lawrence wrote: On 18/02/2014 18:03, Steve Willoughby wrote: Because the regular expression means “match an angle-bracket Please do not top post on this list. Appropriate trimming is also appreciated. Emile ___

Re: [Tutor] how run it on python 3

2014-01-20 Thread Emile van Sebille
On 1/20/2014 4:05 PM, Danny Yoo wrote: S Tareq has asked this question just a few days ago. https://mail.python.org/pipermail/tutor/2014-January/099466.html Most of us here have not yet gone entirely senile yet, so we still remember. Speak for yourself! The rest of us are rapidly approac

Re: [Tutor] how run it on python 3

2014-01-20 Thread Emile van Sebille
On 1/20/2014 12:51 PM, S Tareq wrote: external file ans says invalid syntax . The full traceback with the invalid syntax message will provide you the specific line where the issue is realized. Note that the actual error my occur elsewhere particularly with mismatched parenthetical expressi

Re: [Tutor] another better way to do this ?

2014-01-12 Thread Emile van Sebille
On 01/12/2014 12:21 PM, Peter Otten wrote: test("axbxc", "abc") True test("abbxc", "abc") False Is the second result desired? No -- the second should match -- you found a test case I didn't... def test(a,b): for ii in a: if ii not in b: a=a.replace(ii,"") while ii+ii in a: a=a.r

Re: [Tutor] another better way to do this ?

2014-01-12 Thread Emile van Sebille
On 01/12/2014 06:43 AM, Dave Angel wrote: Roelof Wobben Wrote in message: That documentation says nothing about order. And the test cases specifically contradict it. so try if set (b) <= set (a): or, as the OP specified, if order is relevant, def test(a,b): for ii in a: if ii no

Re: [Tutor] Python & Django

2014-01-09 Thread Emile van Sebille
On 01/09/2014 01:13 AM, Rafael Knuth wrote: Hej there, I am very interested to hear your opinion on which version of Python to use in conjunction with Django. Currently, I am taking a class at Udemy and they recommend using Python 2.7 with Django 1.6. because both versions work well with each ot

Re: [Tutor] recursion depth

2014-01-08 Thread Emile van Sebille
On 1/8/2014 12:25 PM, Keith Winston wrote: I've been playing with recursion, it's very satisfying. However, it appears that even if I sys.setrecursionlimit(10), it blows up at about 24,000 (appears to reset IDLE). I guess there must be a lot of overhead with recursion, if only 24k times are

Re: [Tutor] Positional Arguments

2013-11-01 Thread Emile van Sebille
The traceback shows: > TypeError: calcandprint() missing 2 required positional arguments: > 'hrswrkd' and 'payrate' and the definition of calcandprint is > def calcandprint (hrswrkd, payrate): which shows it requiring two parameters: 'hrswrkd' and 'payrate' so the proper way to call the func

Re: [Tutor] python, xml, mongodb

2013-10-27 Thread Emile van Sebille
Two things bother me about your assignment -- First, you say "i really dunno what format to expect, no details on that" and second, "i have like three weeks to complete this." Doesn't sound like a winning combination to me. :( When I've written systems to aggregate and normalize data from mu

Re: [Tutor] Getting daily averages with pandas

2013-10-13 Thread Emile van Sebille
Hi Boris, Read up on the trig functions in the math module. http://docs.python.org/2/library/math.html#trigonometric-functions Emile On 10/11/2013 6:18 PM, Boris Vladimir Comi wrote: Boris Vladimir Comi escrito: I found a way to create daily averages of many variables, for example of a da

Re: [Tutor] OT: Coffeescript and Python

2013-09-06 Thread Emile van Sebille
On 9/6/2013 3:47 AM, Alan Gauld wrote: This is somewhat off topic so replies offlist may be appropriate. I can fix that. :) Are you familiar with pyjs, which provides python to javascript capabilities? (see http://pyjs.org/) Is there any reason to prefer one over the other? Emile I've

Re: [Tutor] Comment on http://www.catb.org/esr/faqs/smart-questions.html

2013-08-26 Thread Emile van Sebille
perhaps pointing to http://www.catb.org/esr/faqs/smart-questions.html#intro is a better answer? Emile ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Comment on http://www.catb.org/esr/faqs/smart-questions.html

2013-08-26 Thread Emile van Sebille
I suspect that of the referrals made to this site only one-in-ten actually bother to _read_ the damn thing. And those are the ones that quickly move on to the main python list going forward. (I hope!) And while you are right that it doesn't serve the needs of the ten-second-toms out there tha

Re: [Tutor] does anyone know a good module for automation

2013-04-29 Thread Emile van Sebille
I recently automated a scheduled task to retrieve content from an https site that uses javascript for site interaction using iMacros, ahk and the related firefox extension. Not a python solution, but it got the job done. Emile On 4/26/2013 8:28 AM, Frank Schiro wrote: Pywinauto is not work

Re: [Tutor] Python Pipes

2012-10-29 Thread Emile van Sebille
On 10/29/2012 3:33 AM, Ganesh Manal wrote: Please give me sample python program that works with python31 Start with the tutorial at http://docs.python.org/3/tutorial/index.html It'll step you through lots of sample python scripts. Emile ___ Tutor

Re: [Tutor] Question

2012-10-28 Thread Emile van Sebille
On 10/27/2012 2:19 PM, Alan Gauld wrote: On 27/10/12 20:50, Amin Memar wrote: Hi there! How can I use wxpython on python 3.3.0? You can't its not supported yet. So you will need to either port the code yourself or use Python 2.7. This is not uncommon with third party modules a lot of them are

Re: [Tutor] newb help reading lines from csv

2012-10-22 Thread Emile van Sebille
Dewhirst, Rob wrote: import csv ifile = open('test.csv', "r") reader = csv.reader(ifile) for row in reader: print row for row in reader: print row ifile.close() This is a simplified version of what I am trying to do - loop through a CSV file twice. Why does the second for loop n

Re: [Tutor] name conventions

2012-10-22 Thread Emile van Sebille
Mike McTernan wrote: Hi there, I am doing some online tutorials and have found two approaches to naming things: this_is_a_name and thisIsAName. Which one is the best practice for Python? I am a totally newbie to programming and want to make sure I start with the most common approach. The off

Re: [Tutor] Using the set.difference method with an unknown number of input iterables

2012-10-18 Thread Emile van Sebille
On 10/18/2012 10:38 AM, Ryan Waples wrote:> I'm struggling to understand how to understand/accomplish the following: > > I have an set ("a" below) and a list of sets ("not_a"), how can I pass > the elements of "not_a" to set.difference() so that it it understands I > want the difference between s

Re: [Tutor] need an explanation

2012-10-11 Thread Emile van Sebille
Matthew Ngaha wrote: i need help on 2 topics. 1) can someone please tell me what sys is doing, and why its using weird indexing? if __name__ == "__main__": A_Class(*sys.argv[1:4]).A_Class_Method() sys is doing nothing -- argv in sys holds the command line arguments passed into python

Re: [Tutor] OT: Netiquette

2012-10-01 Thread Emile van Sebille
On 9/30/2012 6:16 PM, Dwight Hutto wrote: But he started it. Now be the man and end it. Emile ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor

Re: [Tutor] Python for Absolute Beginners

2012-09-28 Thread Emile van Sebille
On 9/27/2012 9:42 AM Debbie Snowdon said... Help! I'm into Chapter 2 in the Book by Michael Dawson - I cannot access the Companion Guide. Do I need it? Do I have to purchase it? How do I get it? The site he sends me to is very confusing. I'd ask your instructor or look in the book to see if the

Re: [Tutor] Tutor Digest, Vol 103, Issue 124

2012-09-25 Thread Emile van Sebille
On 9/25/2012 9:06 AM Afzal Hossain said... hi i am trying to install python3.1.5 tgz in windows 7 but not getting exe file for installing.can u help me for this On 9/25/12, tutor-requ...@python.org wrote: http://www.catb.org/esr/faqs/smart-questions.html> If you're just starting out, save

Re: [Tutor] How can I convert a variable name to a string?

2012-09-21 Thread Emile van Sebille
On 9/21/2012 2:11 AM Dae James said... How can I convert a variable name to a string ? For example: testVariable = 1000; How can I get the string "testVariable" ? If what you're asking is 'how do I get the value associated with the the string "testVariable"?' then yuo can use something like:

Re: [Tutor] Populating a list with object to be called by a class

2012-09-20 Thread Emile van Sebille
On 9/20/2012 7:41 AM Ara Kooser said... Morning, I dug out some old code from 5 years ago to clean up and get in working order. It's a simple agent based model. I have class called Ant which contains all the ant-like functions. I have a list that tracks the ants but I did this is a very crud

Re: [Tutor] Tutor Digest, Vol 103, Issue 82

2012-09-17 Thread Emile van Sebille
On 9/17/2012 2:24 PM Aaron Pilgrim said... Hello, I am new to python. Here is what I wrote. my lower() function does not work and it can not take capital letters. def func3(): alphabets = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',

Re: [Tutor] How to run this block of code dozens of times

2012-09-17 Thread Emile van Sebille
On 9/16/2012 8:17 PM Steven D'Aprano said... On 17/09/12 10:56, Scurvy Scott wrote: Why would you use an underscore rather than a letter or name like I've always seen. I've never seen an underscore used before. An underscore on its own is often used to mean "don't care". Like a scratch variab

Re: [Tutor] (2.7.3) Inexplicable change of type

2012-09-14 Thread Emile van Sebille
On 9/14/2012 1:43 AM Ray Jones said... The code: source = source.remove('') return source To round things out, here's one way to do what I expect you're expecting: >>> r=range(10) >>> a = r.pop(r.index(4)) >>> a 4 >>> r [0, 1, 2, 3, 5, 6, 7, 8, 9] Emile ___

Re: [Tutor] How to send email from a gmail a/c using smtp when port 587(smtp) is blocked

2012-09-11 Thread Emile van Sebille
On 9/11/2012 2:44 PM ashish makani said... Emile, Please don't presume people's intentions (that we are sending spam) & judge people without knowing anything about them. I made no such presumption -- I appluad the university for taking appropriate actions to reduce the spread of spam. Perhaps

  1   2   3   4   5   6   >