Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-10 Thread Morten Engvoldsen
Hi Dave, Thanks for your reply with full function :) Great forum.. :) On Sun, Feb 10, 2013 at 5:46 PM, David Hutto wrote: > Here is the full function with an instance using the function: > > def text_wrapper(file_name = None, pre_text = None, text = None, > post_text = None): > f = open(

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-10 Thread David Hutto
On Sun, Feb 10, 2013 at 11:45 AM, Morten Engvoldsen wrote: > Hi Dave, > Thanks again for suggestion No problem. I haven't used my python skills in a while, so I went ahead and went through it fully. -- Best Regards, David Hutto CEO: http://www.hitwebdevelopment.com -- http://mail.pytho

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-10 Thread David Hutto
Here is the full function with an instance using the function: def text_wrapper(file_name = None, pre_text = None, text = None, post_text = None): f = open(file_name, 'a') f.write("%s\n%s\n%s\n" % (pre_text, text, post_text)) f.close() text_wrapper(file_name = r"/home/dav

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-10 Thread Morten Engvoldsen
Hi Dave, Thanks again for suggestion On Sun, Feb 10, 2013 at 5:30 PM, David Hutto wrote: > I haven't looked at text wrapper, but it would probably look > something like this in a function, untested: > > def text_wrapper(file_name = None, pre_text = None, text = None, > post_text = None): >

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-10 Thread David Hutto
Oops, I mean : def text_wrapper(file_name = None, pre_text = None, text = None, post_text = None): f = open(file, 'a') f.write("%s\n%s\n%s\n" % (pre_text, text, post_text) f.close() -- http://mail.python.org/mailman/listinfo/python-list

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-10 Thread David Hutto
I haven't looked at text wrapper, but it would probably look something like this in a function, untested: def text_wrapper(file_name = None, pre_text = None, text = None, post_text = None): f = open(file, 'a') f.write("%s\n%s\n%s\n" % (pre_text = None, text, post_text = None) f.close(

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-10 Thread Morten Engvoldsen
Hi Dave, This is good code, simple but makes the Coding Standard better.. Thanks to all again On Sun, Feb 10, 2013 at 5:01 PM, David Hutto wrote: > Kind of like below: > > david@david-HP-Compaq-dc7600-Convertible-Minitower:~$ python > Python 2.7.3 (default, Aug 1 2012, 05:16:07) > [GCC 4.6.3] o

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-10 Thread inq1ltd
On Saturday, February 09, 2013 03:27:16 PM Morten Engvoldsen wrote: > Hi Team, > I Have saved my output in .doc file and want to format the output with > > *Start the File > > Some data here > > > ***End of File* >

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-10 Thread Morten Engvoldsen
Hi, Thanks for your suggestion. This is a great forum for Python. :) On Sun, Feb 10, 2013 at 4:12 PM, inq1ltd wrote: > ** > > On Saturday, February 09, 2013 03:27:16 PM Morten Engvoldsen wrote: > > > Hi Team, > > > I Have saved my output in .doc file and want to format the output with > > > > >

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-09 Thread Morten Engvoldsen
Hi Dave, This sounds great, thanks for your help :) On Sat, Feb 9, 2013 at 6:13 PM, Dave Angel wrote: > On 02/09/2013 10:01 AM, Morten Engvoldsen wrote: > >> Hi Davea, >> I am using Python 2.7. >> >> > Sorry, I should have noticed the python version in the subject line, but > didn't until this r

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-09 Thread Terry Reedy
On 2/9/2013 11:21 AM, rusi wrote: On Feb 9, 7:27 pm, Morten Engvoldsen wrote: Hi Team, I Have saved my output in .doc file and want to format the output with *Start the File Some data here ***End of File* Can y

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-09 Thread Mark Lawrence
On 09/02/2013 14:27, Morten Engvoldsen wrote: Hi Team, I Have saved my output in .doc file and want to format the output with *Start the File Some data here ***End of File* Can you let me know how can i do that using

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-09 Thread Dave Angel
On 02/09/2013 10:01 AM, Morten Engvoldsen wrote: Hi Davea, I am using Python 2.7. Sorry, I should have noticed the python version in the subject line, but didn't until this reply. How about print >> outfile, "Start the File".center(55, "*") after creating the file, and print >> outfile, "

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-09 Thread rusi
On Feb 9, 7:27 pm, Morten Engvoldsen wrote: > Hi Team, > I Have saved my output in .doc file and want to format the output with > > *Start the File > > Some data here > > ***End of File* > > Can you let me know how ca

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-09 Thread Morten Engvoldsen
Hi Davea, I am using Python 2.7. -- http://mail.python.org/mailman/listinfo/python-list

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-09 Thread Peter Otten
Morten Engvoldsen wrote: > I know i can append "***Start file***" in the > batchdata, but is there a better python code like multiply * into 10 times > -- any python code i can add the formatting in dynamic way instead of > hardcoding with "***Start file***

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-09 Thread Morten Engvoldsen
Hi Cain, Thanks for your reply. I am stroning all the contents in "batchdate" and then, data = base64.encodestring(batchdata) and then writing "data" in doc file. I know i can append "***Start file***" in the batchdata, but is there a better python code like multiply * into

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-09 Thread D'Arcy J.M. Cain
On Sat, 9 Feb 2013 15:27:16 +0100 Morten Engvoldsen wrote: > I Have saved my output in .doc file and want to format the output with > > *Start the File > > Some data here > > > ***End of File* > > Can you let me

Re: Any idea how i can format my output file with ********************Start file*********************** usinf Python 2.7

2013-02-09 Thread Dave Angel
On 02/09/2013 09:27 AM, Morten Engvoldsen wrote: Hi Team, I Have saved my output in .doc file and want to format the output with *Start the File Some data here ***End of File* Can you let me know how can i do th

RE: Web Scraping - Output File

2012-04-26 Thread Prasad, Ramit
> > I am having some difficulty generating the output I want from web > > scraping. Specifically, the script I wrote, while it runs without any > > errors, is not writing to the output file correctly. It runs, and > > creates the output .txt file; however, the file is blan

Re: Web Scraping - Output File

2012-04-26 Thread SMac2347
runs without any > > errors, is not writing to the output file correctly. It runs, and > > creates the output .txt file; however, the file is blank (ideally it > > should be populated with a list of names). > > > I took the base of a program that I had before for a dif

Re: Web Scraping - Output File

2012-04-26 Thread Jon Clements
comcast.net> writes: > > Hello, > > I am having some difficulty generating the output I want from web > scraping. Specifically, the script I wrote, while it runs without any > errors, is not writing to the output file correctly. It runs, and > creates the output .txt

Re: Web Scraping - Output File

2012-04-26 Thread Kiuhnm
On 4/26/2012 19:54, smac2...@comcast.net wrote: > Hello, > > I am having some difficulty generating the output I want from web > scraping. Specifically, the script I wrote, while it runs without any > errors, is not writing to the output file correctly. It runs, and > creates th

Re: Web Scraping - Output File

2012-04-26 Thread MRAB
On 26/04/2012 18:54, smac2...@comcast.net wrote: Hello, I am having some difficulty generating the output I want from web scraping. Specifically, the script I wrote, while it runs without any errors, is not writing to the output file correctly. It runs, and creates the output .txt file; however

Web Scraping - Output File

2012-04-26 Thread SMac2347
Hello, I am having some difficulty generating the output I want from web scraping. Specifically, the script I wrote, while it runs without any errors, is not writing to the output file correctly. It runs, and creates the output .txt file; however, the file is blank (ideally it should be populated

pickling to an output file.

2012-02-28 Thread Smiley 4321
) Open the pickle file as above (b) read the pickled object (c) write the output to a file say "output.txt" Can I have know if my above code is reading properly and how to write to an output file 'output.txt' -- http://mail.python.org/mailman/listinfo/python-list

Forcing any output (file / stdout) to UTF-8

2010-06-06 Thread News123
Hi, I'm having a small python script printing out UTF-8 characters. # -*- coding: utf-8 -*- print sys.stdout.encoding s=u"abcdéfg" # string containing one non ASCII character # just in case nntp kills it for c in s: print c It work perfectly fine on my utf-8 capable terminal.

Re: Output file formatting/loop problems -- HELP?

2009-09-08 Thread Maggie
On Sep 8, 12:35 pm, MRAB wrote: > Maggie wrote: > > On Sep 8, 11:39 am, MRAB wrote: > >> Maggie wrote: > >>> My code is supposed to enumerate each line of file (1, 2, 3...) and > >>> write the new version into the output file -- > >>> #

Re: Output file formatting/loop problems -- HELP?

2009-09-08 Thread MRAB
Maggie wrote: On Sep 8, 11:39 am, MRAB wrote: Maggie wrote: My code is supposed to enumerate each line of file (1, 2, 3...) and write the new version into the output file -- #!/usr/bin/python import os.path import csv import sys #name of output file filename = "OUTPUT.txt" #open the

Re: Output file formatting/loop problems -- HELP?

2009-09-08 Thread Hendrik van Rooyen
On Tuesday 08 September 2009 17:22:30 Maggie wrote: > My code is supposed to enumerate each line of file (1, 2, 3...) and > write the new version into the output file -- > > #!/usr/bin/python > > import os.path > import csv > import sys > > #name of output

Re: Output file formatting/loop problems -- HELP?

2009-09-08 Thread Maggie
On Sep 8, 11:39 am, MRAB wrote: > Maggie wrote: > > My code is supposed to enumerate each line of file (1, 2, 3...) and > > write the new version into the output file -- > > > #!/usr/bin/python > > > import os.path > > import csv > > impor

Re: Output file formatting/loop problems -- HELP?

2009-09-08 Thread MRAB
Maggie wrote: My code is supposed to enumerate each line of file (1, 2, 3...) and write the new version into the output file -- #!/usr/bin/python import os.path import csv import sys #name of output file filename = "OUTPUT.txt" #open the file test = open ("test.txt", &q

Output file formatting/loop problems -- HELP?

2009-09-08 Thread Maggie
My code is supposed to enumerate each line of file (1, 2, 3...) and write the new version into the output file -- #!/usr/bin/python import os.path import csv import sys #name of output file filename = "OUTPUT.txt" #open the file test = open ("test.txt", "r") #re

Re: pygccxml xml output file

2009-01-29 Thread Roman
On Jan 24, 3:25 pm, whatazor wrote: > Hi all, > I start to use this module in order to produce xml( and the make other > things), but differently from gccxml I don't find the variable that > set the name of the xml output file after the parsing (in gccxml is - > fxml), so

pygccxml xml output file

2009-01-24 Thread whatazor
Hi all, I start to use this module in order to produce xml( and the make other things), but differently from gccxml I don't find the variable that set the name of the xml output file after the parsing (in gccxml is - fxml), so it creates temporary files. how can I do an Is there a tutorial

Re: How can I redirect print function to an output file?

2006-02-26 Thread Alex Martelli
<[EMAIL PROTECTED]> wrote: > I am using the print function in my python script. > Can you please tell me what can I do to redirect the output to an file? f = open('aaargh', 'w') print>>f, 'killew wabbit' Alex -- http://mail.python.org/mailman/listinfo/python-list

Re: How can I redirect print function to an output file?

2006-02-26 Thread Enoodle
http://diveintopython.org/scripts_and_streams/stdin_stdout_stderr.html example 10.9 , redurectung output -- http://mail.python.org/mailman/listinfo/python-list

How can I redirect print function to an output file?

2006-02-26 Thread Plissken . s
I am using the print function in my python script. Can you please tell me what can I do to redirect the output to an file? Thank you. -- http://mail.python.org/mailman/listinfo/python-list

Re: load module named "datetime" and change the directory of output file?

2006-02-01 Thread Lee Harr
> 1. How can I add a standard module named "datetime" in > Jython when the error happens :"Traceback (innermost > last): > File "C:\python\test.py", line 3, in ? > ImportError: no module named datetime " > The line 3 is writen: "from datetime import datetime, > tzinfor" > The datetime module wa

load module named "datetime" and change the directory of output file?

2006-02-01 Thread ye juan
Hi, all I have some questions to ask: 1. How can I add a standard module named "datetime" in Jython when the error happens :"Traceback (innermost last): File "C:\python\test.py", line 3, in ? ImportError: no module named datetime " The line 3 is writen: "from datetime import datetime, tzinfo

Re: Output File

2005-02-24 Thread Samantha
Thanks Steve. Appreciate it! S "Steven Bethard" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > Samantha wrote: >> input = open(r'C:\Documents and >> Settings\Owner\Desktop\somefile.html','r') >> L = input.readlines() >> input.close >> >> output = open(r'C:\Documents and >> Setting

Re: Output File

2005-02-24 Thread Steven Bethard
Samantha wrote: input = open(r'C:\Documents and Settings\Owner\Desktop\somefile.html','r') L = input.readlines() input.close output = open(r'C:\Documents and Settings\Owner\Desktop\somefile_test.html','w') for t in range(len(L)): output.writelines(L[t]) output.close I think you want to do [1]: in

Output File

2005-02-24 Thread Samantha
Is there a limit on the size of the file Python will read then output. I am reading a file of 433 lines and when I output the same file it only will output 421 lines. The last line is cut off also. This is the code I am using as a test. input = open(r'C:\Documents and Settings\Owner\Desktop\som

Re: [csv module] duplication of end of line character in output file generated

2005-01-11 Thread simon.alexandre
ok thanks it works S. "Kent Johnson" <[EMAIL PROTECTED]> a écrit dans le message de news:[EMAIL PROTECTED] > simon.alexandre wrote: > > Hi all, > > > > I use csv module included in python 2.3. I use the writer and encouter the > > following p

Re: [csv module] duplication of end of line character in output file generated

2005-01-11 Thread Kent Johnson
simon.alexandre wrote: Hi all, I use csv module included in python 2.3. I use the writer and encouter the following problem: in my output file (.csv) there is a duplication of the end of line character, so when I open the csv file in Ms-Excel a blank line is inserted between each data line. From

Re: [csv module] duplication of end of line character in output file generated

2005-01-11 Thread Peter Otten
simon.alexandre wrote: > I use csv module included in python 2.3. I use the writer and encouter the > following problem: in my output file (.csv) there is a duplication of the > end of line character, so when I open the csv file in Ms-Excel a blank > line is inserted between ea

[csv module] duplication of end of line character in output file generated

2005-01-11 Thread simon.alexandre
Hi all, I use csv module included in python 2.3. I use the writer and encouter the following problem: in my output file (.csv) there is a duplication of the end of line character, so when I open the csv file in Ms-Excel a blank line is inserted between each data line. OS: W2k Someone has an