I have a large text file.
Several chunks of it are delimited by a pair of small strings:
"...zczjczjsstr1pqcqdiocpqsstr2ufusvsdvnvvsstr1nnfnenefenzzezf zefsstr2ydgyrger..."
How could I loop over the text file and delete what appears repeatedly between sstr1 and sstr2?
The result should be:
"...zczjczjufus vsdvnvvydgyrger ...".
User Profile
Collapse
-
gesqo started a topic In Python, loop to delete several substrings delimited by the same pair of substringsin PythonIn Python, loop to delete several substrings delimited by the same pair of substrings
-
I did.But it messes (xlrd3 doesn't arrive to install with "python setup.py install --prefix=c:\pytho n33")... -
xlrd in python 3.3
I'm trying to run with Python 3.3:
I get the error message:Code:import lib2to3 import sys import string import xlrd workbook = xlrd.open_workbook(r'C:\....xlsx',encoding_override="cp1252") worksheet = workbook.sheet_by_name('Sheet1') workbook.sheet_names() ..................
Traceback (most recent call last):
File "C:\....py" , line 23, in <module>... -
-
I didn't say «read by a python program»,so I don't undrestand well your question.
If you meant how I created the cv file:with «f.write('file. csv','w')».
I expect a solution smth like «column.split».Leave a comment:
-
More precise
This is a better illustration of what I need:
A B C D E
1 adfhyhh*ihhgfdt ykk*red*piuol adfhyhh ihhgfdt red piuol
2 ehethe tthy tytuiuu aaaaaaa ehethe tthy tytu aaaaa
[imgnothumb]http://bytes.com/attachments/attachment/6736d1353625474/screenshotexcel .jpg[/imgnothumb]...Leave a comment:
-
How do I split a column of a csv file in excel using python 3.3?
I have a column of some hundreds rows, obtained by a python program,each cell containing 4 unequal (in length) strings,like:
adfhyhh ihhgfdtykk red piuol
How can I split it with python in 4 colomns,with each cell containing one string?
Thanks.
No activity results to display
Show More
Leave a comment: