Re: [Tutor] To FORMAT or not to

2016-01-04 Thread Bod Soutar via Tutor
On 4 January 2016 at 19:50, Mark Lawrence > > Three reasons for why it's better but it doesn't actually work as given. > island = "Isle Of Wight" new = "Isle of Wong" print("You've visited {0} & {2}.".format(island, new)) > Traceback (most recent call last): > File "", line 1, in

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

2015-05-21 Thread Bod Soutar
On 21 May 2015 at 15:39, Steven D'Aprano wrote: > On Thu, May 21, 2015 at 12:55:13PM +, Albert-Jan Roskam via Tutor wrote: >> Hi, >> >> I would like to hide .pyc and .pyo files because they are visually >> distracting. Is the aforementioned command the best way? [1]. > > It isn't clear what yo

Re: [Tutor] Is there an easily or shorter way?

2014-12-15 Thread Bod Soutar
On 15 December 2014 at 21:25, Ken G. wrote: > I am sure there is a better way to refine the following lines. > > Letting x equal a number from 1 to 28, go through 28 separate 'if' > statements to print a resulting value that equaled the value of x. > > For example: > > x = 8 > > if x = 1, print 'o

Re: [Tutor] Project suggestions

2014-03-13 Thread Bod Soutar
On 13 March 2014 02:29, Scott W Dunning wrote: > Hey Everyone, > > I just got through doing a Guess-the-number script and was looking for > something else to practice on. Do any of you have any suggestions on some > things I could work on? Keep in mind I am not only extremely new to python > I

Re: [Tutor] Using Regular Expression to extracting string in brackets on a list

2013-12-29 Thread Bod Soutar
Steven's answer is probably a lot more robust, but I would use a simple split. mylist = ['hypothetical protein BRAFLDRAFT_208408 [Branchiostoma floridae]\n', 'hypoxia-inducible factor 1-alpha [Mus musculus]\n', 'hypoxia-inducible factor 1-alpha [Gallus gallus]\n' ] for item in mylist: item.spl

Re: [Tutor] install on windows

2013-07-10 Thread Bod Soutar
Right click the msi > run as admin On Wednesday, 3 July 2013, larry seibold wrote: > I am stuck at step one, installing "python-2.7.5.msi" on windows XP. I > downloaded it (~16MB), but when I select it (double click), I get a windows > installer pop up with an OK button at the bottom, which when

Re: [Tutor] Issue w/ program: Flip a coin and count heads and tails

2013-05-24 Thread Bod Soutar
On 24 May 2013 12:01, Rafael Knuth wrote: > Hello, > > I am writing a program in Python 3.3.0 which flips a coin 10 x times and > then counts the number of heads and tails. It obviously does something else > than I intended, and I am wondering what I did wrong: > > import random > > print (""" > >

Re: [Tutor] try..except - what about that ton of **Error statements?

2013-05-21 Thread Bod Soutar
On 22 May 2013 07:20, Jim Mooney wrote: >> Keep the try block small. For example if it's for a call to >> open(filename, "r") the only possible errors (assuming correct syntax) >> are NameError for using an undefined variable and IOError for >> specifying a file which doesnt exist. > > Thanks. Sin

Re: [Tutor] urllib.urlretrieve ?

2013-04-07 Thread Bod Soutar
On 7 April 2013 20:59, Matthew Ngaha wrote: >>org/2/library/urllib.html#urllib.urlretrieve >> or >> http://docs.python.org/3/library/urllib.request.html#urllib.request.urlretrieve > sorry about the top posting gmail has changed the way their messages > are done, it gave me a blank field i didnt re

Re: [Tutor] Help required

2013-04-04 Thread Bod Soutar
On 20 March 2013 06:12, Arijit Ukil wrote: > I am new to python. My intention is to read the file digi.txt and store in > separate arrays all the values of each columns. However, the following > program prints only the last value, i.e. 1350696500.0. > Please help to rectify this. > > f = open ("di

Re: [Tutor] Need help on win32 application error

2013-04-02 Thread Bod Soutar
On 2 April 2013 19:19, wrote: > Hi Team, > I am facing folowing erro while executing python code: > Win32 exception occurred releasing IUnknown at 0x03210eb8 > Please let me know the resolution of the same.PFA the version details of > python exe that I am using. > > > Thanks

Re: [Tutor] Python help!!

2013-04-02 Thread Bod Soutar
On 2 April 2013 17:49, David Mitchell wrote: > Hi! > > How do I go through a text file, finding specific words/numbers/phrases and > edit them to say different things? I do not want to edit the text file, I > would rather open and read from the text file and write to a new file. > > I do NOT want

Re: [Tutor] HELP: Creating animation from multiple plots

2013-03-27 Thread Bod Soutar
You were opening the file for reading, rather than writing. It therefore was expecting to find a file. Change fo = open('fname','r+') to fo = open('fname','w') Bodsda On 27 March 2013 16:17, Sayan Chatterjee wrote: > for t in range(0,200): > fname = 'file_' + str(t) > > So it will assign fname

Re: [Tutor] Beep sound

2013-03-24 Thread Bod Soutar
> Thank you for your reply Bodsda, > > Actually, I didn't think there was any need to make any guesses since "echo > -e" is exclusively a Linux command. Anyway, I had already spent some time > searching for an answerer and the answer given most often was to "modprobe > pcspkr". This didn't lead to

Re: [Tutor] Beep sound

2013-03-23 Thread Bod Soutar
On Mar 23, 2013 2:24 AM, "Steven D'Aprano" wrote: > > On 23/03/13 12:48, Phil wrote: >> >> Just out of curiosity how can a beep sound be generated? >> >> My interest in this came about because echo -e '\a' no longer works. Also print '\a' doesn't work, presumably for the same reason. The following

[Tutor] Fwd: converting upper case to lowercase and vice-versa

2013-03-15 Thread Bod Soutar
Did'nt realise this went offlist, my fault -- Bodsda -- Forwarded message -- From: Shall, Sydney Date: 15 March 2013 14:43 Subject: Re: [Tutor] converting upper case to lowercase and vice-versa To: Bod Soutar On 15/03/2013 14:30, Bod Soutar wrote: On 15 March 2013

Re: [Tutor] Text Processing Query

2013-03-14 Thread Bod Soutar
On 14 March 2013 10:56, Spyros Charonis wrote: > Hello Pythoners, > > I am trying to extract certain fields from a file that whose text looks like > this: > > COMPND 2 MOLECULE: POTASSIUM CHANNEL SUBFAMILY K MEMBER 4; > COMPND 3 CHAIN: A, B; > COMPND 10 MOL_ID: 2; > COMPND 11 MOLECULE: ANTIB

Re: [Tutor] Help with a SQL Statement

2012-11-18 Thread Bod Soutar
On Nov 18, 2012 11:30 AM, "Khalid Al-Ghamdi" wrote: > > Hi, I found one typo in 'Workshop&' which should be 'Workshop%' but it still gives results containing majors with 'Customer%' and 'Warehouse%' in them... > > > On Sun, Nov 18, 2012 at 2:21 PM, Khalid Al-Ghamdi wrote: >> >> Hi All, >> >> The

Re: [Tutor] OT: Netiquette

2012-09-28 Thread Bod Soutar
On Sep 28, 2012 4:47 AM, "Dwight Hutto" wrote: > > On Wed, Sep 26, 2012 at 6:59 AM, Walter Prins wrote: > > Dwight, > > > > On 26 September 2012 09:26, Dwight Hutto wrote: > >> The only face I personally want to see of him > >>> because of this is his back. > >>> > >> > >> You wanna see my ass,

Re: [Tutor] Script won't run for no apparent reason

2012-08-10 Thread Bod Soutar
>> > OK, I have put it back into Python 2.7, and now I get: > > Traceback (most recent call last): > File "crypto.py", line 27, in > encrypt() > File "crypto.py", line 7, in encrypt > textInputE.list() > AttributeError: 'str' object has no attribute 'list' Would it be a strange conclu

Re: [Tutor] Search and replace text in XML file?

2012-07-28 Thread Bod Soutar
On Jul 28, 2012 2:39 AM, "Todd Tabern" wrote: > > I'm looking to search an entire XML file for specific text and replace that text, while maintaining the structure of the XML file. The text occurs within multiple nodes throughout the file. > I basically need to replace every occurrence C:\Program

Re: [Tutor] Issue with classes

2012-06-12 Thread Bod Soutar
On Jun 12, 2012 9:56 AM, "Andreas Perstinger" wrote: > > On Tue, 12 Jun 2012 09:07:13 +0100 > Bod Soutar wrote: > > > C:\>python cheatsheet.py --list > > done > > here? > > Traceback (most recent call last): > > File "cheatsheet

[Tutor] Issue with classes

2012-06-12 Thread Bod Soutar
Hi, I am having some difficulty calling a class method from a different class. When I run the attached script like this "python cheatsheet.py --list" C:\>python cheatsheet.py --list done here? Traceback (most recent call last): File "cheatsheet.py", line 167, in main() File "cheatsheet.p

Re: [Tutor] Coding Challenges

2012-05-21 Thread Bod Soutar
Pop onto http://ubuntuforums.org and find the programming talk sub-forum. One of the stickies there is an index of beginner programming challenges. It's a rolling process where the winner of the previous challenge posts a new one and then picks a winning entry who goes on to post the next challenge

Re: [Tutor] Iterate Suggestion

2012-04-14 Thread Bod Soutar
On 14 April 2012 18:29, Bod Soutar wrote: > > > On 14 April 2012 16:27, Tom Tucker wrote: > >> >> Hello all. Any suggestions how I could easily iterate over a list and >> print the output 3 across (when possible)? One method I was considering >> was removin

Re: [Tutor] Iterate Suggestion

2012-04-14 Thread Bod Soutar
On 14 April 2012 16:27, Tom Tucker wrote: > > Hello all. Any suggestions how I could easily iterate over a list and > print the output 3 across (when possible)? One method I was considering > was removing the recently printed item from the list, checking list length, > etc. Based on the remain

Re: [Tutor] Questions Regarding Sockets

2012-04-14 Thread Bod Soutar
On 14 April 2012 17:41, Khalid Al-Ghamdi wrote: > Hi All, > > (python 3.2 on windows) > > I have a couple of questions regarding the below code: > > 1- In line (15), what are these variables tcpCliSock, addr supposed to > hold and do? > 2- Why do I have to specify the buffer size and what does it

Re: [Tutor] Unable to open .py files directly

2012-03-21 Thread Bod Soutar
On Mar 21, 2012 1:03 PM, "Surya K" wrote: > > > > > Date: Mon, 19 Mar 2012 19:11:18 -0400 > From: bgai...@gmail.com > To: sur...@live.com > CC: tutor@python.org > Subject: Re: [Tutor] Unable to open .py files directly > > > On 3/19/2012 10:30 AM, Surya K wrote: >>

Re: [Tutor] Cmd Advice

2012-02-05 Thread Bod Soutar
On Feb 5, 2012 3:31 PM, "Dave Hanson" wrote: > > Thanks Alan. > > I have ran python programs before at work. But not ones you need to continually interact with from the command line. This particular program needs that. > > Dos isn't unavailable, just windows + r and cmd are disabled by IT. > > I c

[Tutor] Beginner Programming Challenges

2011-11-20 Thread Bod Soutar
FOA: Any aspiring new programmers looking for some inspiration or projects. There is a series of programming challenges being run on the ubuntu forums The challenges are aimed at beginners, and although they assume you are running linux, this is not always a requirement.

Re: [Tutor] I am trying to print list elements but i am getting 'none'

2011-10-10 Thread Bod Soutar
On 10 October 2011 14:26, Praveen Singh wrote: > This is my code- >  def getNumbers(num): >     myList=[] >     for numbers in range(0,num,2): >   print myList.append(numbers) > > > output- getNumbers(10) > None > None > None > None > None > > Then i find out that list.append doesn't

Re: [Tutor] How to give input to a list

2011-10-02 Thread Bod Soutar
On 2 October 2011 04:20, surya kasturi wrote: > Hi, > > How give input to a list all at once. > I mean if we declared a array and like to take input for it > > for (i=0;i<5;i++) >     scanf("%d",&array[i]); > here we can give input of 5 numbers with a space in command prompt. > > Similarly in pyth