473,404 Members | 2,187 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,404 software developers and data experts.

Python Equivalent to Text::Autoformat

I'm new to both Perl & Python.

Is there a Python module or script somewhere comparable to the useful
Perl module - Text::Autoformat?

Thanks,

BS

Dec 3 '05 #1
5 1710
Google is your freind.
Try searching for:
python text wrapping

- Paddy.

Dec 4 '05 #2
>>try searching on text wrapping<<

I tried that before I posted. Text::Autoformat does a lot more than
textwrap.

"The fundamental task of the autoformat subroutine is to identify and
rearrange independent paragraphs in a text. Paragraphs typically
consist of a series of lines containing at least one non-whitespace
character, followed by one or more lines containing only optional
whitespace. This is a more liberal definition than many other
formatters use: most require an empty line to terminate a paragraph.
Paragraphs may also be denoted by bulleting, numbering, or quoting . .
.."

Once a paragraph has been isolated, autoformat fills and re-wraps its
lines according to the margins that are specified in its argument list.
These are placed after the text to be formatted, in a hash reference:"

It's also sensitive to comment characters in code and so on.

But I'll keep looking. Thank you.

bs

Dec 4 '05 #3
On 4 Dec 2005 05:58:08 -0800,
"BartlebyScrivener" <rp*******@gmail.com> wrote:
try searching on text wrapping<<
I tried that before I posted. Text::Autoformat does a lot more than
textwrap.

"The fundamental task of the autoformat subroutine is to identify and
rearrange independent paragraphs in a text. Paragraphs typically
consist of a series of lines containing at least one non-whitespace
character, followed by one or more lines containing only optional
whitespace. This is a more liberal definition than many other
formatters use: most require an empty line to terminate a paragraph.
Paragraphs may also be denoted by bulleting, numbering, or quoting . .
."


Try the formatter module:

http://www.python.org/doc/current/li...formatter.html

Regards,
Dan

--
Dan Sommers
<http://www.tombstonezero.net/dan/>
Dec 4 '05 #4
BartlebyScrivener wrote:
try searching on text wrapping<<


I tried that before I posted. Text::Autoformat does a lot more than
textwrap.


Sounds like you are describing something known by various names, often
including some part of "structured text". Try googling for that
instead: http://www.google.com/search?q=python+structured+text

-Peter

Dec 4 '05 #5
Formatter and docutils both look promising.

Thanks for providing the terminology to search on.

-rpd

Dec 4 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Mike Kamermans | last post by:
I hope someone can help me, because what I'm going through at the moment trying to edit XML documents is enough to make me want to never edit XML again. I'm looking for an XML editor that has a...
12
by: Lecture Snoddddgrass | last post by:
I know that this thing is pre-beta, so I'm hoping there's still time for you to change the defaults for text formatting options in the IDE (C# section). One of my least favorite things about...
2
by: Jose | last post by:
Hi. how to when i wrote the time on input it shows two points automatic? (12:23) Regards, José.
2
by: Micah Williamson | last post by:
Does anyone know how to make it so that a time entered as a string, and stored in a string record in an access 2000 database can be kept as a string? When ever I enter a time like 1:00:00 PM...
1
by: Carlo | last post by:
Hi How do I get textbox text to be formatted on the fly as entering. I have a textbox which will hold numerics larger than a million which I want to autoformat i.e FormatNumber, so that it makes...
6
by: CindyH | last post by:
Hi Does anyone know how to create a multi column combo box from the same table? Thanks, Cindy
12
by: coolminded | last post by:
plz urgent help needed i have one data grid in the form. i have to export the data from the datagrid to the word. i just exported the data in MS word into a table. but i want to remove the table...
3
by: Jef Driesen | last post by:
How can I convert a date string to a number (e.g. a time_t value or a tm struct)? I know about the strptime function, but then I have to know the format string. And that is a problem. I'm trying...
4
by: BG Mahesh | last post by:
hi We are using the normal html controls (textarea) in the posting form. The form page has the utf-8 character set. Users are copying the text from MS Word or Openoffice doc etc. Our PHP...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.