Re: [Tutor] Writing to a file

2018-01-19 Thread Steven D'Aprano
On Fri, Jan 19, 2018 at 12:58:10PM -0500, Bob Gailer wrote: > = > > On Jan 18, 2018 5:45 PM, "Devansh Rastogi" wrote: > > > > Hello, > > > > I'm new to python and programming as > > > > from collections import Counter > > import json > > > I don't see any value for having a class. All you need ar

Re: [Tutor] Writing to a file

2018-01-19 Thread Bob Gailer
= On Jan 18, 2018 5:45 PM, "Devansh Rastogi" wrote: > > Hello, > > I'm new to python and programming as > > from collections import Counter > import json > I don't see any value for having a class. All you need are functions and global variables > class Files: > def __init__(self, filename):

Re: [Tutor] Writing to a file

2018-01-18 Thread Alan Gauld via Tutor
On 18/01/18 20:51, Devansh Rastogi wrote: > When do you actually use json or pickle, I understand that with data > written to .json files can be used by programs written in other languages, > and pickle is for python specific objects. Yes, that's correct. > So are there specific objects > for w

[Tutor] Writing to a file

2018-01-18 Thread Devansh Rastogi
Hello, I'm new to python and programming as such and as an exercise for I/O am writing a small program that reads data from a .txt file, and analyzes the text, ie, number of words/characters, avg. length of words, and frequency of words and characters. Once the text has been analyzed, the results

Re: [Tutor] Writing to a file/changing the file name

2012-02-23 Thread bob gailer
On 2/23/2012 12:04 AM, Michael Lewis wrote: Hi everyone, I have a program where I open a file (recipe.txt), I read that file and write it to another file. I am doing some multiplying of numbers in between; however, my question is, when I name the file I am writing to, the file extension is ch

Re: [Tutor] Writing to a file/changing the file name

2012-02-22 Thread Christian Witts
On 2012/02/23 07:04 AM, Michael Lewis wrote: Hi everyone, I have a program where I open a file (recipe.txt), I read that file and write it to another file. I am doing some multiplying of numbers in between; however, my question is, when I name the file I am writing to, the file extension is c

[Tutor] Writing to a file/changing the file name

2012-02-22 Thread Michael Lewis
Hi everyone, I have a program where I open a file (recipe.txt), I read that file and write it to another file. I am doing some multiplying of numbers in between; however, my question is, when I name the file I am writing to, the file extension is changed, but the file name is not. What am I doing

Re: [Tutor] Writing to a file problem....

2008-12-05 Thread spir
Marty Pitts a écrit : Date: Fri, 5 Dec 2008 23:48:32 +0100 From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Subject: Re: [Tutor] Writing to a file problem zip_command = "c:\Users\Marty\Zip\Zip -!rv '%s' %s" % (target, ' '.join(source)) What if you jus

Re: [Tutor] Writing to a file problem....

2008-12-05 Thread Kent Johnson
On Fri, Dec 5, 2008 at 3:51 AM, Marty Pitts <[EMAIL PROTECTED]> wrote: > #5. We use the zip command to put files in a zip archive > zip_command = "c:\Users\Marty\Zip\Zip -!rv '%s' %s" % (target, ' > '.join(source)) It might help to print zip_command, to make sure it is what you expect. You can

Re: [Tutor] Writing to a file problem....

2008-12-05 Thread wesley chun
marty, i applaud you in your efforts to port this script to the Win32 platform. the task is not as simple as one may expect, due to the differing file pathname nomenclatures that the different operating systems use. because of this, i have a couple of suggestions: 1. highly recommend converting

[Tutor] Writing to a file problem....

2008-12-05 Thread Marty Pitts
Hi, I am currently working my way through the .pdf Byte of Python tutorial by Swaroop, C H After about 1/2 way I ran into a problem that my own trouble shooting has failed :-(. The script created is for backing up files into a .zip format. It is written by the author in a *nix environment.