Re: [Tutor] Code to download credit card statement and add to DB

2018-04-20 Thread Kuan Lu
Hello Mr. Tutor: I constructed a pieced of code utilizing requests and pyodbc to download creditcard statement transactions and insert them into a DB table based on the code published by Louis Millette here: https://github.com/louismillette/Banking/tree/master. Now I am a total newbie to Pytho

Re: [Tutor] Code to download credit card statement and add to DB

2018-04-20 Thread Kuan Lu
Hello Mr. Tutor: I constructed a pieced of code utilizing requests and pyodbc to download creditcard statement transactions and insert them into a DB table based on the code published by Louis Millette here: https://github.com/louismillette/Banking/tree/master. Now I am a total newbie to Pytho

Re: [Tutor] Code

2017-12-20 Thread Steven D'Aprano
On Tue, Dec 19, 2017 at 07:22:50PM -0500, Vinay Rao wrote: > Hi, > > We need help coding the range formula, and we don’t really know how to > do it. This is the formula, R=(V2Sin2theangle)/(g). We are trying to > solve for the angle. That's not a Python problem, that's a basic algebra problem.

Re: [Tutor] Code

2017-12-19 Thread boB Stepp
Welcome to Tutor! We won't do your homework for you, but will help you if you get stuck. Normally you would show us your current best coding effort and we would help you from there. On Tue, Dec 19, 2017 at 6:22 PM, Vinay Rao wrote: > Hi, > > We need help coding the range formula, and we don’t re

[Tutor] Code

2017-12-19 Thread Vinay Rao
Hi, We need help coding the range formula, and we don’t really know how to do it. This is the formula, R=(V2Sin2theangle)/(g). We are trying to solve for the angle. Thanks, Vinay ___ Tutor maillist - Tutor@python.org To unsubscribe or change subs

Re: [Tutor] Code not working advise pls

2016-11-04 Thread Cameron Simpson
On 04Nov2016 21:57, tracey jones-Francis wrote: 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 greater than the number of elements in the list, all elements should be incl

[Tutor] Code not working advise pls

2016-11-04 Thread tracey jones-Francis
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 greater than the number of elements in the list, all elements should be included in the sum. In addition i want to write

Re: [Tutor] Code for python game

2016-10-12 Thread Derry, James R
@python.org] on behalf of tracey jones-Francis [drtraceyjo...@hotmail.com] Sent: Wednesday, October 12, 2016 12:40 PM To: tutor@python.org Subject: [Tutor] Code for python game Im in the middle of designing a game in python, im quite new to using it and am struggling with a certain bit of code

Re: [Tutor] Code for python game

2016-10-12 Thread Alan Gauld via Tutor
On 12/10/16 18:40, tracey jones-Francis wrote: > I want to have a function that will ignore certain words that > i have specified in a dictionary. > the dictionary is called skip_words and has about 20 different strings in. We shouldn't care inside the function what the external data is called,

[Tutor] Code for python game

2016-10-12 Thread tracey jones-Francis
Im in the middle of designing a game in python, im quite new to using it and am struggling with a certain bit of code. I want to have a function that will ignore certain words that i have specified in a dictionary. I have tried so many different types of code but can't seem to return just the ke

Re: [Tutor] Code wont run

2016-04-16 Thread Alan Gauld
On 09/04/16 10:32, Nevina Dias via Tutor wrote: Sorry for the delay the message was in the moderation queue and I was on holiday. As to your code it has not been posted in plain text so its been scrambled by the email system. We can't begin to decipher it. When you say it "won't run", do you get

[Tutor] Code wont run

2016-04-16 Thread Nevina Dias via Tutor
import random import time  print ("Welcome to Pizza Shed!") total_cost = 0 tablenum = input ("Enter table number from 1-25 \n ")tablenum = int(tablenum)while tablenum>25 or tablenum <=0:     tablenum = input ("Enter the correct table number, there are only 25 tables ")     #Pizza menu with price

Re: [Tutor] Code Problem

2016-03-10 Thread Alan Gauld
On 10/03/16 20:30, Ben Conklin wrote: > show if it is a equilateral, isosceles, or right triangle. I have it so > that it makes s1 the longest side, and s2 and s3 the other 2 sides. The > right triangle equation should be right, but is not outputting anything. The easiest way to find that is just

[Tutor] Code Problem

2016-03-10 Thread Ben Conklin
Hi, I'm having troubles with my code, specifically at the area with the comment mark. Basically you are to enter three sides of a triangle, and have it show if it is a equilateral, isosceles, or right triangle. I have it so that it makes s1 the longest side, and s2 and s3 the other 2 sides. The ri

Re: [Tutor] Code Regress

2016-02-01 Thread boB Stepp
On Mon, Feb 1, 2016 at 8:22 AM, Evan Sommer wrote: > I tried the code suggestion that you proposed in december, and while > it did count down time, it actually set me back in a way because the > display is not how I desired it to be. I think you need to review all of Alan's previous suggestions.

[Tutor] Code Regress

2016-02-01 Thread Evan Sommer
Hey again Alan! Sorry it has been so long since I have been in contact. I tried the code suggestion that you proposed in december, and while it did count down time, it actually set me back in a way because the display is not how I desired it to be. The way the display looks in this program below

Re: [Tutor] Code critique

2014-10-25 Thread Crush
Thank you Peter for your example. I have the code working now and will post soon for eveyones benefit. Thank you all who took the time to help. Bo ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.pyt

Re: [Tutor] Code critique

2014-10-25 Thread Peter Otten
Bo Morris wrote: > Thank you all for the helpful criticism. I wish I was able to catch on to > what you are suggesting more quickly. > > Based on your recommendations, I have come up with the following so far, > however I just dont see it as easily as I did while using the if/elif > statements. >

Re: [Tutor] Code critique

2014-10-24 Thread Bo Morris
Thank you all for the helpful criticism. I wish I was able to catch on to what you are suggesting more quickly. Based on your recommendations, I have come up with the following so far, however I just dont see it as easily as I did while using the if/elif statements. This is what I have so far. I

Re: [Tutor] Code critique

2014-10-24 Thread Japhy Bartlett
out = stdout.read() if '3102EHD-Lanka-1108' in out: s.exec_command('export DISPLAY=:0.0; cd /Downloads/Hourly/win.sh') sftp = s.open_sftp() sftp.get('/Downloads/Hourly/3102EHD-01108/3102EHD-01108.png', '/Downloads/Hourly/3102EHD-01108.png') sftp.close() print

Re: [Tutor] Code critique

2014-10-24 Thread Peter Otten
Bo Morris wrote: > "...Regarding your program, instead of writing long sequences of > repetitive if > conditions, I would write one function for each of the different > operations and store them in a dict, mapping each host name to a function > (and multiple host names may map to the same function

Re: [Tutor] Code critique

2014-10-24 Thread Bo Morris
"...Regarding your program, instead of writing long sequences of repetitive if conditions, I would write one function for each of the different operations and store them in a dict, mapping each host name to a function (and multiple host names may map to the same function). Then, look up the host na

Re: [Tutor] Code critique

2014-10-24 Thread Stefan Behnel
Bo Morris schrieb am 24.10.2014 um 14:03: > May I please get a little instructional criticism. The code below works. It > logs into 9 different Linux computers, runs a couple commands, and then > transfers a file back to the server. I want to become a better Python > coder; therefore, I was hoping

[Tutor] Code critique

2014-10-24 Thread Bo Morris
Hello all, May I please get a little instructional criticism. The code below works. It logs into 9 different Linux computers, runs a couple commands, and then transfers a file back to the server. I want to become a better Python coder; therefore, I was hoping for some ways to make the below code b

Re: [Tutor] code help

2014-09-29 Thread Alan Gauld
On 22/09/14 16:16, itsthewendigo . wrote: from tkinter import* master = Tk(); canvas = Canvas(master, width = simpledialog.askinteger("Canvas size", "Enter width of canvas")) Its generally a bad idea to mix interactivity with widget creation. Better(and much easier to debug) to query the

[Tutor] code help

2014-09-29 Thread itsthewendigo1111 .
I'm taking an online intro to programing class unfortunately the teacher has not be very helpful. well this is the assignment http://burtondsc.pbworks.com/w/file/fetch/84469141/Assignment03.pdf and here is my code so far from tkinter import* master = Tk(); canvas = Canvas(master, width = si

Re: [Tutor] code review

2014-06-13 Thread Adam Gold
On 12/06/14 00:38, Alan Gauld wrote: > > HTH Thanks Alan and Lukáš for your very helpful comments. I will attempt to revise the script in light of them and will revert if I hit any brick walls :) ___ Tutor maillist - Tutor@python.org To unsubscribe

Re: [Tutor] code review

2014-06-12 Thread Cameron Simpson
On 13Jun2014 12:28, Cameron Simpson wrote: snap_path = os.path.join(VXGEN_DIR, snapName) backupList.append(snap_name) Sorry, "snap_path" in both lines:-( Cheers, Cameron Simpson ___ Tutor maillist - Tutor@python.org To unsubscribe or change sub

Re: [Tutor] code review

2014-06-12 Thread Cameron Simpson
On 12Jun2014 00:38, Alan Gauld wrote: On 11/06/14 11:43, Adam Gold wrote: # create snapshot names like the following: 2014-06-10T01-00-01.vm1.img.bz2 for i in vgxenList: DATE = datetime.datetime.now().strftime("%Y-%m-%d" + "T" + "%H-%M-%S") Why use addition? You could just insett the lite

Re: [Tutor] code review

2014-06-11 Thread Alan Gauld
On 11/06/14 11:43, Adam Gold wrote: # create snapshot names like the following: 2014-06-10T01-00-01.vm1.img.bz2 for i in vgxenList: DATE = datetime.datetime.now().strftime("%Y-%m-%d" + "T" + "%H-%M-%S") Why use addition? You could just insett the literal T... DATE = datetime.datetime.now

Re: [Tutor] code review

2014-06-11 Thread Lukáš Němec
Ok, not so bad, hoewer there are some parts of the code that could be done a bit cleaner. I'll write them below in the response. Thanks for the reply Steven. It's no more than 100 lines at a guess In that case just copy and paste it into a message and send it to the group. Anyone with time av

Re: [Tutor] code review

2014-06-11 Thread Adam Gold
>>> Thanks for the reply Steven. It's no more than 100 lines at a >>> guess > >> In that case just copy and paste it into a message and send it to >> the group. Anyone with time available can then take a peek. > > One way noobs anywhere can learn is by listening in to other people's > conversati

Re: [Tutor] code review

2014-06-11 Thread Bob Williams
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 11/06/14 08:11, Alan Gauld wrote: > On 11/06/14 00:30, Adam Gold wrote: > >> Thanks for the reply Steven. It's no more than 100 lines at a >> guess > > In that case just copy and paste it into a message and send it to > the group. Anyone with tim

Re: [Tutor] code review

2014-06-11 Thread Alan Gauld
On 11/06/14 00:30, Adam Gold wrote: Thanks for the reply Steven. It's no more than 100 lines at a guess In that case just copy and paste it into a message and send it to the group. Anyone with time available can then take a peek. hth -- Alan G Author of the Learn to Program web site http:

Re: [Tutor] code review

2014-06-11 Thread Adam Gold
On 11/06/14 00:04, Steven D'Aprano wrote: > On Tue, Jun 10, 2014 at 04:51:20PM +0100, Adam Gold wrote: >> Hi there. I've been writing a script that is now finished and working >> (thanks, in part, to some helpful input from this board). What I'd >> really like to do now is go through it with an '

Re: [Tutor] code review

2014-06-10 Thread Lukas Nemec
Post it somewhere on github and I'll try to take a look at it. Lukas On 06/10/2014 05:51 PM, Adam Gold wrote: Hi there. I've been writing a script that is now finished and working (thanks, in part, to some helpful input from this board). What I'd really like to do now is go through it with an

Re: [Tutor] code review

2014-06-10 Thread Steven D'Aprano
On Tue, Jun 10, 2014 at 04:51:20PM +0100, Adam Gold wrote: > Hi there. I've been writing a script that is now finished and working > (thanks, in part, to some helpful input from this board). What I'd > really like to do now is go through it with an 'expert' who can point > out ways I may have bee

[Tutor] code review

2014-06-10 Thread Adam Gold
Hi there. I've been writing a script that is now finished and working (thanks, in part, to some helpful input from this board). What I'd really like to do now is go through it with an 'expert' who can point out ways I may have been able to code more efficiently/effectively. I don't think it woul

Re: [Tutor] Code runs in interpreter but won't output to stdout

2014-02-01 Thread scurvy scott
Please always reply to the tutor list so we can all play with your question. --sorry about that Bob, I've now hit reply all. I am stuck at "import requests". Where did you get that module? --requests is a third party webscraping module. I signed up at Dogehouse. What the heck is it? There is no

Re: [Tutor] Code runs in interpreter but won't output to stdout

2014-02-01 Thread Walter Prins
Hi Bob, On 31 January 2014 21:59, bob gailer wrote: > On 1/29/2014 8:59 PM, scurvy scott wrote: > I signed up at Dogehouse. What the heck is it? There is no explanation as to > what it does or what I'd do with it! I don't know if you're familiar with BitCoin and the concept of the "pooled mining

Re: [Tutor] Code runs in interpreter but won't output to stdout

2014-01-31 Thread bob gailer
On 1/29/2014 8:59 PM, scurvy scott wrote: Please always reply to the tutor list so we can all play with your question. On 1/28/2014 9:12 PM, scurvy scott wrote: Hi guys, I'm trying to figure out why my code won't output to terminal, but will run just fine in interpreter. I'm using

Re: [Tutor] Code runs in interpreter but won't output to stdout

2014-01-29 Thread bob gailer
On 1/28/2014 9:12 PM, scurvy scott wrote: Hi guys, I'm trying to figure out why my code won't output to terminal, but will run just fine in interpreter. I'm using python 2.7.3 on Debian Linux/Crunchbang. Here is my code. import requests from bs4 import BeautifulSoup as beautiful import sys de

[Tutor] Code runs in interpreter but won't output to stdout

2014-01-29 Thread scurvy scott
Hi guys, I'm trying to figure out why my code won't output to terminal, but will run just fine in interpreter. I'm using python 2.7.3 on Debian Linux/Crunchbang. Here is my code. import requests from bs4 import BeautifulSoup as beautiful import sys def dogeScrape(username, password): payload

Re: [Tutor] code works in windows command but not ubuntu terminal

2014-01-25 Thread spir
On 01/26/2014 02:12 AM, Steven D'Aprano wrote: On Sat, Jan 25, 2014 at 09:11:56AM +0100, spir wrote: As a foreigner, I noticed that english native speakers use both the series round / square / curly / angle brackets, and individual terms parens (no 'd' ;-) / brackets / braces / chevrons. No maj

Re: [Tutor] code works in windows command but not ubuntu terminal

2014-01-25 Thread Mark Lawrence
On 26/01/2014 01:55, Steven D'Aprano wrote: This is an international forum, and English an international language with many slight differences between variations and dialects. Even in American English alone, there are ambiguous terms. "Coke" could mean a beverage by the Coca-Cola company, a gene

Re: [Tutor] code works in windows command but not ubuntu terminal

2014-01-25 Thread Steven D'Aprano
On Sat, Jan 25, 2014 at 02:39:11PM -0500, bob gailer wrote: > On 1/24/2014 10:28 PM, bob gailer wrote: > > Sorry for misspelling parens. > > My reason for requesting the various names is that it makes > communication clear, explicit and terse. > > When someone says just "brackets" what does he

Re: [Tutor] code works in windows command but not ubuntu terminal

2014-01-25 Thread Steven D'Aprano
On Sat, Jan 25, 2014 at 09:11:56AM +0100, spir wrote: > As a foreigner, I noticed that english native speakers use both the series > round / square / curly / angle brackets, and individual terms parens (no > 'd' ;-) / brackets / braces / chevrons. No major issue, except for > 'brackets' which c

Re: [Tutor] code works in windows command but not ubuntu terminal

2014-01-25 Thread Alan Gauld
On 25/01/14 19:39, bob gailer wrote: On 1/24/2014 10:28 PM, bob gailer wrote: Sorry for misspelling parens. My reason for requesting the various names is that it makes communication clear, explicit and terse. When someone says just "brackets" what does he actually mean? In UK English speakin

Re: [Tutor] code works in windows command but not ubuntu terminal

2014-01-25 Thread bob gailer
On 1/24/2014 10:28 PM, bob gailer wrote: Sorry for misspelling parens. My reason for requesting the various names is that it makes communication clear, explicit and terse. When someone says just "brackets" what does he actually mean? For more grins see http://www.codinghorror.com/blog/2008/

Re: [Tutor] code works in windows command but not ubuntu terminal

2014-01-25 Thread Mark Lawrence
On 25/01/2014 03:28, bob gailer wrote: And please call () parends and [] brackets, and{} braces. Saves a lot of confusion. Not in the UK or Australia, with the former being where English came from. -- My fellow Pythonistas, ask not what our language can do for you, ask what you can do for o

Re: [Tutor] code works in windows command but not ubuntu terminal

2014-01-25 Thread spir
On 01/25/2014 05:14 AM, Steven D'Aprano wrote: On Fri, Jan 24, 2014 at 10:28:09PM -0500, bob gailer wrote: And please call () parends and [] brackets, and{} braces. Saves a lot of confusion. If you think that parentheses are spelt with a "d", you're certainly confused :-) They're all bracket

Re: [Tutor] code works in windows command but not ubuntu terminal

2014-01-24 Thread eryksun
On Fri, Jan 24, 2014 at 8:38 PM, Steven D'Aprano wrote: > > However, there's more to it than this. For starters, you need to decide > on the exact behaviour. Clearly, "file not found" errors should move on > to try the next prefix in the path list. But what about permission > denied errors? Prior

Re: [Tutor] code works in windows command but not ubuntu terminal

2014-01-24 Thread Steven D'Aprano
On Fri, Jan 24, 2014 at 10:28:09PM -0500, bob gailer wrote: > And please call () parends and [] brackets, and{} braces. Saves a lot of > confusion. If you think that parentheses are spelt with a "d", you're certainly confused :-) They're all brackets. Often the type of bracket doesn't matter,

Re: [Tutor] code works in windows command but not ubuntu terminal

2014-01-24 Thread bob gailer
On 1/24/2014 4:47 AM, Steven D'Aprano wrote: Hi Tobias, and welcome. On Thu, Jan 23, 2014 at 07:34:18PM -0700, Tobias Quezada wrote: hello community,i am a newbie to python and program in general. the script below works in python 2.7.3 on windows but not in the python 2.7.3 ubuntu terminal.

Re: [Tutor] code works in windows command but not ubuntu terminal

2014-01-24 Thread Steven D'Aprano
On Fri, Jan 24, 2014 at 04:31:49PM -0500, Keith Winston wrote: > On Fri, Jan 24, 2014 at 4:50 AM, Steven D'Aprano wrote: > > Python does not use a search path for the open() function, only for > > imports. With open(), it uses a simple rule: > > > > - absolute paths will look only in that exact lo

Re: [Tutor] code works in windows command but not ubuntu terminal

2014-01-24 Thread Danny Yoo
> Ah! I was just running into this... I did not know that. So there's no > way to get it to search a path (other than coding some string > concatenation of path names or something, of course) to open a file? Potentially distutils.spawn.find_executable might apply, http://docs.python.org/2/dis

Re: [Tutor] code works in windows command but not ubuntu terminal

2014-01-24 Thread Keith Winston
On Fri, Jan 24, 2014 at 4:50 AM, Steven D'Aprano wrote: > Python does not use a search path for the open() function, only for > imports. With open(), it uses a simple rule: > > - absolute paths will look only in that exact location; > > - relative paths are always relative to the current working d

Re: [Tutor] code works in windows command but not ubuntu terminal

2014-01-24 Thread Alan Gauld
On 24/01/14 02:34, Tobias Quezada wrote: >>>fp=open("prez.dat","r") >>>x=fp.read >>>(print(x) /IOError: [Errno 2] No such file or directory: 'prez.dat'/ Python can't see your file. You can check what python is seeing by importing os and using listdir(): import os os.listdir(',') # . is

Re: [Tutor] code works in windows command but not ubuntu terminal

2014-01-24 Thread maxin...@gmail.com
hello community,i am a newbie to python and program in general. the script below works in python 2.7.3 on windows but not in the python 2.7.3 ubuntu terminal. >>>fp=open("prez.dat","r")>>>x=fp.read>>>(print(x)***i used fp for file >>>pointer.I am using windows 7 and it works but on ubuntu 12.04

Re: [Tutor] code works in windows command but not ubuntu terminal

2014-01-24 Thread Steven D'Aprano
On Fri, Jan 24, 2014 at 04:22:20AM -0500, Keith Winston wrote: > The file would appear to not be on your search path, that is, in any > directory in which Python is expecting to find it. Python does not use a search path for the open() function, only for imports. With open(), it uses a simple rul

Re: [Tutor] code works in windows command but not ubuntu terminal

2014-01-24 Thread Steven D'Aprano
Hi Tobias, and welcome. On Thu, Jan 23, 2014 at 07:34:18PM -0700, Tobias Quezada wrote: > hello community,i am a newbie to python and program in general. > the script below works in python 2.7.3 on windows but not in the python 2.7.3 > ubuntu terminal. > > >>> fp=open("prez.dat","r") > >>> x=fp.

Re: [Tutor] code works in windows command but not ubuntu terminal

2014-01-24 Thread Peter Otten
Tobias Quezada wrote: > hello community,i am a newbie to python and program in general. > the script below works in python 2.7.3 on windows but not in the python > 2.7.3 ubuntu terminal. > fp=open("prez.dat","r")>>>x=fp.read>>>(print(x)***i used fp for file pointer.I am using windows 7 an

Re: [Tutor] code works in windows command but not ubuntu terminal

2014-01-24 Thread Keith Winston
I should have mentioned, the other possibility is that the file does not, in fact, exist, but I assume you put it out there somewhere? ___ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/l

Re: [Tutor] code works in windows command but not ubuntu terminal

2014-01-24 Thread Keith Winston
The file would appear to not be on your search path, that is, in any directory in which Python is expecting to find it. Either move it to a directory on your path, or change your path to include it's location. The easiest way to find out what your path is, that I know, is import sys sys.path Good

[Tutor] code works in windows command but not ubuntu terminal

2014-01-24 Thread Tobias Quezada
hello community,i am a newbie to python and program in general. the script below works in python 2.7.3 on windows but not in the python 2.7.3 ubuntu terminal. >>>fp=open("prez.dat","r")>>>x=fp.read>>>(print(x)***i used fp for file >>>pointer.I am using windows 7 and it works but on ubuntu 12.04

Re: [Tutor] code smells: Object-orientation Abusers: switch statements

2014-01-04 Thread Danny Yoo
Compare: ### class Dog(object): pass class Cat(object): pass class Cow(object): pass def sayHi(animal): if isinstance(animal, Dog): print("Woof") elif isinstance(animal, Cat): print("Meow") elif isinstance(animal, Cow):

Re: [Tutor] code smells: Object-orientation Abusers: switch statements

2014-01-04 Thread Alan Gauld
I meant to add... On 04/01/14 20:47, Alan Gauld wrote: Its called polymorphism and is one of the most powerful advantages of OOP since case or switch statements are one of the most fault prone structures in procedural programming. ... Without OOP you would need to do something like for shape i

Re: [Tutor] code smells: Object-orientation Abusers: switch statements

2014-01-04 Thread Alan Gauld
On 04/01/14 20:11, Alex Kleider wrote: Assuming I am correct that in Python, switch statements must be implemented as a series of if; elif; .. statements, how is it that this can be avoided by creating subclasses? Its called polymorphism and is one of the most powerful advantages of OOP sinc

[Tutor] code smells: Object-orientation Abusers: switch statements

2014-01-04 Thread Alex Kleider
Continuing to look into the subject of code smells, I ran across this: "The situation where switch statements or type codes are needed should be handled by creating subclasses." @ http://www.soberit.hut.fi/mmantyla/BadCodeSmellsTaxonomy.htm Assuming I am correct that in Python, switch statement

Re: [Tutor] Code to open a website

2013-02-11 Thread Alan Gauld
On 11/02/13 01:14, Steven D'Aprano wrote: exit() and quit() (as added by the site.py module) are for interactive use. aha! They're mostly there for the benefit of newbies. Experienced developers (at least in the Unix/Linux world) usually know to exit interactive terminal apps with Ctrl-D. I

Re: [Tutor] Code to open a website

2013-02-10 Thread Steven D'Aprano
On 10/02/13 20:25, ALAN GAULD wrote: Maybe the OP meant to say 'quit()' ? That does not require an import. Ooh! another option I didn't know about! So many ways to get rid of Python and here's me been importing sys or raising SystemExit all these years... :-) exit() and quit() (as added

Re: [Tutor] Code to open a website

2013-02-10 Thread eryksun
On Sun, Feb 10, 2013 at 3:39 AM, ALAN GAULD wrote: > So it does. You learn something new every day... > When did that first happen? It was one of my biggest frustrations > with Python when I first started learning, that you couldn't call exit > without first importing sys (v1.3). But I never notic

Re: [Tutor] Code to open a website

2013-02-10 Thread Peter Otten
ALAN GAULD wrote: >> Maybe the OP meant to say 'quit()' ? That does not require an import. > > > Ooh! another option I didn't know about! > So many ways to get rid of Python and here's me been importing sys > or raising SystemExit all these years... :-) I tend to use none of these and my script

Re: [Tutor] Code to open a website

2013-02-10 Thread ALAN GAULD
> Maybe the OP meant to say 'quit()' ? That does not require an import. Ooh! another option I didn't know about! So many ways to get rid of Python and here's me been importing sys  or raising SystemExit all these years... :-) Alan G. ___ Tutor mailli

Re: [Tutor] Code to open a website

2013-02-10 Thread Albert-Jan Roskam
> On Sat, Feb 9, 2013 at 8:33 PM, Alan Gauld > wrote: >> >> Where does exit() come from? Usually its from sys but you >> don't import from sys anywhere... > > site.py adds the exit/quit Quitter instances to builtins (2.x > __builtin__). When called they raise SystemExit, like sys.exit does

Re: [Tutor] Code to open a website

2013-02-10 Thread ALAN GAULD
>site.py adds the exit/quit Quitter instances to builtins (2.x >__builtin__). When called they raise SystemExit, like sys.exit does. So it does. You learn something new every day... When did that first happen? It was one of my biggest frustrations  with Python when I first started learning, that

Re: [Tutor] Code to open a website

2013-02-09 Thread mann kann
oh wow, I foolishly named it webbrowser.py earlier. Thanks for the witty hint, Danny :) On Sat, Feb 9, 2013 at 11:55 PM, Danny Yoo wrote: > On Sat, Feb 9, 2013 at 6:25 PM, mann kann wrote: > > I used webbrowser and it worked via terminal, but the same code returns > > AttrituteError: 'module'

Re: [Tutor] Code to open a website

2013-02-09 Thread Danny Yoo
On Sat, Feb 9, 2013 at 6:25 PM, mann kann wrote: > I used webbrowser and it worked via terminal, but the same code returns > AttrituteError: 'module' object has no attribute 'open' in komodo edit. > suggestions? here's the code: > > import webbrowser > webbrowser.open("http://youtube.com";) What

Re: [Tutor] Code to open a website

2013-02-09 Thread eryksun
On Sat, Feb 9, 2013 at 8:33 PM, Alan Gauld wrote: > > Where does exit() come from? Usually its from sys but you > don't import from sys anywhere... site.py adds the exit/quit Quitter instances to builtins (2.x __builtin__). When called they raise SystemExit, like sys.exit does. Since you can bypa

Re: [Tutor] Code to open a website

2013-02-09 Thread Alan Gauld
On 10/02/13 01:00, mann kann wrote: Dear Jedi, I wrote my first program but it doesn't open a website as I intended it to. Please correct my mistake. Well, how did you intend it to? It looks like it probably does open the web site, but it will be hard to tell since you do nothing with the res

Re: [Tutor] Code to open a website

2013-02-09 Thread mann kann
I used webbrowser and it worked via terminal, but the same code returns AttrituteError: 'module' object has no attribute 'open' in komodo edit. suggestions? here's the code: import webbrowser webbrowser.open("http://youtube.com";) On Sat, Feb 9, 2013 at 8:17 PM, Wayne Werner wrote: > On Sat,

Re: [Tutor] Code to open a website

2013-02-09 Thread Wayne Werner
On Sat, 9 Feb 2013, mann kann wrote: Dear Jedi,  I wrote my first program but it doesn't open a website as I intended it to. Please correct my mistake.  Sincerely,  Mann You'll actually want the webbrowser module, which will open the links in your web browser - at least if you want to load s

[Tutor] Code to open a website

2013-02-09 Thread mann kann
Dear Jedi, I wrote my first program but it doesn't open a website as I intended it to. Please correct my mistake. Sincerely, Mann def a(): import urllib.request url = "http://www.google.com"; response = urllib.request.urlopen(url) g = input("Please enter y or n to go to youtube :

Re: [Tutor] code to generate my own text captchas

2012-10-25 Thread Alan Gauld
On 24/10/12 22:05, Tsila Hassine wrote: Hello all, I am looking for simple python code that will take a given string and distort it, captcha like. it is for artistic purposes, so no verification required. I just need the image q text distortion code. A Google search for 'python captcha generato

Re: [Tutor] code to generate my own text captchas

2012-10-24 Thread Steven D'Aprano
On 25/10/12 08:05, Tsila Hassine wrote: Hello all, I am looking for simple python code that will take a given string and distort it, captcha like. You won't find any such simple code, because distorting images is not simple. This is a mailing list for learning how to program in the Python prog

Re: [Tutor] code to generate my own text captchas

2012-10-24 Thread Modulok
On 10/24/12, Tsila Hassine wrote: > Hello all, > I am looking for simple python code that will take a given string and > distort it, captcha like. it is for artistic purposes, so no verification > required. I just need the image q text distortion code. > Thanks!!! > tsila You might look into writ

Re: [Tutor] code to generate my own text captchas

2012-10-24 Thread Mark Lawrence
On 24/10/2012 22:05, Tsila Hassine wrote: Hello all, I am looking for simple python code that will take a given string and distort it, captcha like. it is for artistic purposes, so no verification required. I just need the image q text distortion code. Thanks!!! tsila I'll send you some code i

[Tutor] code to generate my own text captchas

2012-10-24 Thread Tsila Hassine
Hello all, I am looking for simple python code that will take a given string and distort it, captcha like. it is for artistic purposes, so no verification required. I just need the image q text distortion code. Thanks!!! tsila -- -- missdata.org

Re: [Tutor] Code Review?

2012-08-07 Thread Tino Dai
On Mon, Aug 6, 2012 at 6:27 PM, Brian Carpio wrote: > Thanks to everyone who has replied! This is some good information for me > to go learn with!. > > I greatly appreciate it. > > When you refactor your code, let us know. I, for one, would like to see it.

Re: [Tutor] Code Review?

2012-08-06 Thread Brian Carpio
Thanks to everyone who has replied! This is some good information for me to go learn with!. I greatly appreciate it. Brian On Mon, Aug 6, 2012 at 9:21 AM, Peter Otten <__pete...@web.de> wrote: > Brian Carpio wrote: > > > Hi, > > > > Hopefully I am allowed to ask this here. I am pretty new to py

Re: [Tutor] Code Review?

2012-08-06 Thread Peter Otten
Brian Carpio wrote: > Hi, > > Hopefully I am allowed to ask this here. I am pretty new to python I've > only been writing code for about 6 months now strictly for system > administration purposes; however I have now decided to write something > "real" that others might benefit from but I am looki

Re: [Tutor] Code Review?

2012-08-06 Thread Mark Lawrence
On 06/08/2012 14:38, Ramchandra Apte wrote: [top posting fixed] On 6 August 2012 18:59, Brian Carpio wrote: Hi, Hopefully I am allowed to ask this here. I am pretty new to python I've only been writing code for about 6 months now strictly for system administration purposes; however I have n

Re: [Tutor] Code Review?

2012-08-06 Thread Tino Dai
On Mon, Aug 6, 2012 at 9:39 AM, Ramchandra Apte wrote: > Another practice is make __license__ = "GPL license..." > and __author__ = "Brian Carpio " > I do so. > > > On 6 August 2012 19:08, Ramchandra Apte wrote: > >> In scripts/add_node.py GPL Licene should be GPL License >> >> >> Brian, I

Re: [Tutor] Code Review?

2012-08-06 Thread Ramchandra Apte
In scripts/add_node.py GPL Licene should be GPL License On 6 August 2012 18:59, Brian Carpio wrote: > Hi, > > Hopefully I am allowed to ask this here. I am pretty new to python I've > only been writing code for about 6 months now strictly for system > administration purposes; however I have now

Re: [Tutor] Code Review?

2012-08-06 Thread Ramchandra Apte
Another practice is make __license__ = "GPL license..." and __author__ = "Brian Carpio " I do so. On 6 August 2012 19:08, Ramchandra Apte wrote: > In scripts/add_node.py GPL Licene should be GPL License > > On 6 August 2012 18:59, Brian Carpio wrote: > >> Hi, >> >> Hopefully I am allowed to ask

[Tutor] Code Review?

2012-08-06 Thread Brian Carpio
Hi, Hopefully I am allowed to ask this here. I am pretty new to python I've only been writing code for about 6 months now strictly for system administration purposes; however I have now decided to write something "real" that others might benefit from but I am looking for someone to take a look at

Re: [Tutor] [TUTOR]Code Deciphering(Re-sent)

2011-12-16 Thread Calle
On 15 December 2011 23:37, Calle wrote: I was wondering, how do you use Python to decipher codes? It feels like it should be pretty simple, but I haven't found any tutorials about it yet. What kind of codes? Or do you mean ciphers? Generally speaking, a code represent letters or numbers in

Re: [Tutor] [TUTOR]Code Deciphering

2011-12-15 Thread Alan Gauld
On 15/12/11 23:53, Robert Sjoblom wrote: you'll learn a lot more if you work toward the solution yourself. I'll just point you in the direction of ASCII values for now. You might find the ord() function useful too... -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/

Re: [Tutor] [TUTOR]Code Deciphering

2011-12-15 Thread Steven D'Aprano
Calle wrote: Hi! I was wondering, how do you use Python to decipher codes? It feels like it should be pretty simple, but I haven't found any tutorials about it yet. This is not a tutorial, but you might find it useful: http://pypi.python.org/pypi/obfuscate/ -- Steven

Re: [Tutor] [TUTOR]Code Deciphering

2011-12-15 Thread Robert Sjoblom
On 15 December 2011 23:37, Calle wrote: > -Ursprungligt meddelande- From: Robert Sjoblom > Sent: Thursday, December 15, 2011 10:34 PM > To: Calle > Cc: tutor@python.org > Subject: Re: [Tutor] [TUTOR]Code Deciphering > > >> I was wondering, how do you use Python

  1   2   3   >