Re: [Tutor] Read, Write, Split and Append lines from a text file

2014-07-20 Thread Alan Gauld
On 19/07/14 22:27, LN A-go-go wrote: AK 36 AL 39 AR 39 AZ 45 CA 61 CO 54 # and now my newbie attempt: # I can get this far in approach #1 >>> filename = "z:/Geog482/egund919/Program1/BOJ.txt" >>> myfile = open(filename,"r") >>> newfile = "z:/Geog482/egund919/Program1/BOJ_B.txt" >>> mynewfil

Re: [Tutor] Using module Facebook

2014-07-20 Thread Chris
Dear Danny, thank you for your detailed reply. On 07/19/2014 03:26 AM, Danny Yoo wrote: > This is what piqued my concerns. As you can see from the transcript, > the search shows that there's not a single use of 'iteritems' anywhere > in the facebook-sdk, across the entire history of that project

[Tutor] (no subject)

2014-07-20 Thread LN A-go-go
My apologies Python Gurus for repeating this request for read, write, split and append from a text file in notepad.  I worked on it till late last night and will again today.  I can't seem to get past trying to write the names to one list and the numbers (converted to integers) to the other.  My

Re: [Tutor] Using module Facebook

2014-07-20 Thread Albert-Jan Roskam
- On Sun, Jul 20, 2014 6:16 PM CEST Chris wrote: >Dear Danny, > >thank you for your detailed reply. > >On 07/19/2014 03:26 AM, Danny Yoo wrote: >> This is what piqued my concerns. As you can see from the transcript, >> the search shows that there's not a single use of

Re: [Tutor] Using module Facebook

2014-07-20 Thread Danny Yoo
> I'm not sure, what the error was. I had also installed another facebook > package, not facebook-sdk. Maybe this was the reason. I would upgrade that "maybe" to an "almost certainly". :P You should have mentioned that detail of installing that second facebook library. It's actually crucial to

Re: [Tutor] (no subject)

2014-07-20 Thread Danny Yoo
On Sun, Jul 20, 2014 at 8:40 AM, LN A-go-go wrote: > My apologies Python Gurus for repeating this request for read, write, split > and append from a text file in notepad. I worked on it till late last night > and will again today. I can't seem to get past trying to write the names to > one list

Re: [Tutor] (no subject)

2014-07-20 Thread Danny Yoo
> It also appears that you are trying to write whole programs at the > interpreter loop. This can be inconvenient for larger programs. You > might want to use a text editor or IDE to write the program as a > single file, and then run Python over that program file. See: https://hkn.eecs.berk

Re: [Tutor] (no subject)

2014-07-20 Thread Marc Tompkins
On Sun, Jul 20, 2014 at 8:40 AM, LN A-go-go wrote: > > States OJ > AK 36 > AL 39 > AR 39 > AZ 45 > CA 61 > CO 54 > CT 61 > DC 93 > DE 62 > FL 51 > GA 47 > HI 72 > IA 54 > ID 36 > IL 62 > IN 50 > KS 41 > KY 41 > LA 40 > MA 62 > MD 62 > ME 58 > MI 57 > MN 54 > MO 49 > MS 43 > MT 47 > NC 50 > ND 45

Re: [Tutor] (no subject)

2014-07-20 Thread Alan Gauld
On 20/07/14 21:37, Marc Tompkins wrote: Fourth (and here I differ from some of the others on this list, notably Alan G) - I don't like the "while True: / break" paradigm. FWIW I don't like it either, but it has become a canonical Python idiom. In fact in this case I suggested he use a for loo

[Tutor] Is this possible for a newbie?

2014-07-20 Thread keith papa
Am a newbie to programming and I started learning python days ago. I have this idea I want to execute, am a big sport and fantasy fan and I wanted to create something that will make it things a little easy for me. My idea is simple I want to create a program that I can enter name and some inform

Re: [Tutor] (no subject)

2014-07-20 Thread Wolfgang Maier
On 20.07.2014 17:40, LN A-go-go wrote: >>> filename = "C:/Python27/egund919/Program1/BOJ.txt" >>> myfile = open(filename,"r") >>> newfile = "C:/Python27/egund919/Program1/BOJ_B.txt" >>> mynewfile = open(newfile,"w") >>> while True: line = myfile.readline() print line mynewfile.write(l

Re: [Tutor] (no subject)

2014-07-20 Thread Wolfgang Maier
On 20.07.2014 22:37, Marc Tompkins wrote: First of all, I would take advantage of the "with" construction, like so: with open('C:/Python27/egund919/Program1/BOJ_B.txt','r') as infile: #do stuff with infile When the block of code inside of the "with" section finishes, Python will take care

Re: [Tutor] Is this possible for a newbie?

2014-07-20 Thread Alan Gauld
On 20/07/14 21:57, keith papa wrote: me. My idea is simple I want to create a program that I can enter name and some information about a player, for example: NFL plays: Jamaal Charles RB : ATT 259 , YDS 1,287 , AVG 5.0, TD 12, REC 70 Tony Romo QB: CMP% 63.9, YDS 3,828 , TD 31, INT 10, Rating 9

Re: [Tutor] (no subject)

2014-07-20 Thread Marc Tompkins
On Sun, Jul 20, 2014 at 2:37 PM, Alan Gauld wrote: > In fact in this case I suggested he use a for loop to iterate over > the file and use a dictionary to store the results... Ah. I missed that, as I've only noticed this newer thread. And I apologize for imputing motive (a liking for "while Tr

Re: [Tutor] (no subject)

2014-07-20 Thread Mark Lawrence
On 21/07/2014 01:34, Marc Tompkins wrote: On Sun, Jul 20, 2014 at 2:37 PM, Alan Gauld wrote: In fact in this case I suggested he use a for loop to iterate over the file and use a dictionary to store the results... Ah. I missed that, as I've only noticed this newer thread. And I apologize f

Re: [Tutor] Is this possible for a newbie?

2014-07-20 Thread Steven D'Aprano
On Sun, Jul 20, 2014 at 04:57:24PM -0400, keith papa wrote: > Am a newbie to programming and I started learning python days ago. I > have this idea I want to execute, am a big sport and fantasy fan and I > wanted to create something that will make it things a little easy for > me. My idea is si

Re: [Tutor] (no subject)

2014-07-20 Thread Marc Tompkins
On Sun, Jul 20, 2014 at 6:12 PM, Mark Lawrence wrote: >> Ah. I missed that, as I've only noticed this newer thread. And I >> apologize for imputing motive (a liking for "while True"); I'd just >> noticed that you often advise it. I don't know who _does_ think this >> is a desirable pattern; I'

Re: [Tutor] (no subject)

2014-07-20 Thread Mark Lawrence
On 21/07/2014 03:05, Marc Tompkins wrote: On Sun, Jul 20, 2014 at 6:12 PM, Mark Lawrence wrote: Ah. I missed that, as I've only noticed this newer thread. And I apologize for imputing motive (a liking for "while True"); I'd just noticed that you often advise it. I don't know who _does_ thin

Re: [Tutor] Is this possible for a newbie?

2014-07-20 Thread Danny Yoo
>> Am a newbie to programming and I started learning python days ago. I >> have this idea I want to execute, am a big sport and fantasy fan and I >> wanted to create something that will make it things a little easy for >> me. My idea is simple I want to create a program that I can enter name >> and

[Tutor] Ending a loop with a condition not at the top

2014-07-20 Thread Ben Finney
Marc Tompkins writes: > And I apologize for imputing motive (a liking for "while True"); I'd > just noticed that you often advise it. I don't know who _does_ think > this is a desirable pattern; I'd love to hear their argument for it - > it must be really good. It works better than alternatives

Re: [Tutor] Ending a loop with a condition not at the top

2014-07-20 Thread Ben Finney
Marc Tompkins writes: > Seriously, though, how is > 1) Do {this} forever, until something happens that I'll tell you about > later > > better than > 2) Do {this} until this condition, which I'm telling you about RIGHT > NOW, changes > ? Here's how: The first of them is already implemented in P

Re: [Tutor] Is this possible for a newbie?

2014-07-20 Thread Monte Milanuk
On 2014-07-21, Steven D'Aprano wrote: > On Sun, Jul 20, 2014 at 04:57:24PM -0400, keith papa wrote: > >> Am a newbie to programming and I started learning python days ago. I > > This sounds more like something for a database than for Python itself. > > You can write Python code to talk to the dat

Re: [Tutor] Ending a loop with a condition not at the top

2014-07-20 Thread Marc Tompkins
On Sun, Jul 20, 2014 at 8:10 PM, Ben Finney wrote: > Marc Tompkins writes: > >> Seriously, though, how is >> 1) Do {this} forever, until something happens that I'll tell you about >> later >> >> better than >> 2) Do {this} until this condition, which I'm telling you about RIGHT >> NOW, changes >