On 2/4/19 10:13 AM, Valerio Pachera wrote: > > I have a file with row that split at the 80th character. > The next row start with a blank space, meaning that i part of the previous > row. > > Example: > > Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam non justo enim. > Viv > amus dapibus quis neque vitae ornare. Pellentesque at pharetra sapien, id > eleif > end lacus. Nullam ut semper enim, vulputate venenatis justo. Vestibulum > vehicul > a dolor sit amet ultricies vulputate. Aenean lobortis, nulla eu scelerisque > hen > > What do you suggest to get the text on a single line?
joining the lines is simple - use an empty string as the thing to join on, and if you want to ditch the beginning space there's a function for that too (lstrip). But... if you don't have a precise way to know if a word was split in the middle or on a space (or do you know this?), you probably need human intervention to reassemble the original. _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor