473,406 Members | 2,713 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

how to make a paragraph from file to file

12
how to make a paragraph from file to file

like this e.g data.txt

i
want
eat
some
pizza
with
cappucino
in
kuta
bali



to this data2.txt

i want eat some pizza with cappucino in kuta bali

but without exchange the code i free change data.txt

e.g

i
want
eat
some
pizza
with
cappucino
in
kuta
bali
late
night

i want eat some pizza with cappucino in kuta bali late night
Nov 6 '08 #1
3 2729
Fabez
29
First you will need to open the first file and concatanate it into a string line by line. Then you will need to write this string to your second file.
Nov 7 '08 #2
ndoe
12
hmmmm,can you show the code please thanks!!!
Nov 8 '08 #3
bvdet
2,851 Expert Mod 2GB
It's quite basic:
Expand|Select|Wrap|Line Numbers
  1. data = open('data.txt').read()
  2. print ' '.join(data.split('\n'))
To write to another file:
Expand|Select|Wrap|Line Numbers
  1. f = open('data1.txt', 'w')
  2. f.write(' '.join(data.split('\n')))
  3. f.close()
Nov 8 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Sean G. | last post by:
Howdy, I have a series of crystal reports, some have subreports, that I need to put together in one file on one click form the user. So put I imported the separate rpt files as subreports into...
0
by: znmaster | last post by:
I've made a "big" AcitveX control, it uses a lot of .dll files In order to make a cab file ,I have to make a .inf file first. I've read related files in MSDN .But they are too short. I need a...
5
by: barbara_dave | last post by:
Hi, all, I'd like to know if there a way to make the text file unreadable. I want the user to read file only in my program, but not allow to read files from outside of my program. How to do...
7
by: danijela | last post by:
Hi again! I have one more question. How can i make an exe file from my ..Net VB project which would work on win 98, win 2000 and so on...(I'm using .Net Visual studio 2003 professional) Thanks! ...
2
by: many_years_after | last post by:
Hi: some one said we can make a python file to an COM object through py2exe , but I haven't got the method. Could any one who knows tell me how to do? Thanks
10
xxoulmate
by: xxoulmate | last post by:
how to make the exe file made in vb to be run only once.., i mean is only one application can be run a time. commonly we can run multi application of a specific exe file.. ex. test.exe can be...
6
by: wxPythoner | last post by:
Hello! I have trouble understanding something in this code snippet: class TextReader: """Print and number lines in a text file.""" def __init__(self, file): self.file = file
8
by: sandeepkavade | last post by:
Hi I am having 10 bmp files and i want to make 1 gif file out of that using GDI+. Each bmp file should be displayed for particular time period. I searched a lot but unable to find the answer. I want...
0
by: elay | last post by:
i want to make a .swf file without using flex builder. is it possible? Is there any other free tool to compile mxml files & make .swf files? because i want to upload a file using action script...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.