Last active
August 29, 2015 14:00
-
-
Save minthemiddle/11186525 to your computer and use it in GitHub Desktop.
Simple line split and string removal/slice from the end of file
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
string = """ | |
Introduction 03:39 | |
How to sell your websites for $15,000 09:16 | |
SECTION 2: BEATING THE COMPETITION: HOW TO DIFFERENTIATE YOUR WEB DESIGN SERVICES | |
""" | |
stringSplit = '' | |
stringNewlineBreak = string.split('\n') | |
for n in stringNewlineBreak: | |
stringSplit += n[:-6] + '\n' | |
stringSplitCleaned = os.linesep.join( | |
[s for s in stringSplit.splitlines() if s]) | |
print stringSplitCleaned |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment