Please delete my mail address from that mail list. Thanks!
2009-09-01 01:04:44 GMT
_______________________________________________ Tutor maillist - Tutor <at> python.org http://mail.python.org/mailman/listinfo/tutor
_______________________________________________ Tutor maillist - Tutor <at> python.org http://mail.python.org/mailman/listinfo/tutor
_______________________________________________ Tutor maillist - Tutor <at> python.org http://mail.python.org/mailman/listinfo/tutor
Hello,
I have 2 plain text documents that have uneven spacing. I need to make these single spaced between lines and between words. Basically I need to get them to be equal character length after I abridge the uneven spacing. In Python there is probably one simple command for this for a text file? How do I do this?
E.G.: Hi how are you?
Fixed: Hi how are you?
Thanks,
Ishan
_______________________________________________
Tutor maillist - Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor
_______________________________________________ Tutor maillist - Tutor <at> python.org http://mail.python.org/mailman/listinfo/tutor
there are directions on how to remove yourself from the list at the bottom of every message that the list sends out.
_______________________________________________
Tutor maillist - Tutor <at> python.org
http://mail.python.org/mailman/listinfo/tutor
_______________________________________________ Tutor maillist - Tutor <at> python.org http://mail.python.org/mailman/listinfo/tutor
Alan Gauld wrote: > "Stefan Behnel" <stefan_ml <at> behnel.de> wrote >>> "pedro" <pedrooconnell <at> gmail.com> wrote >>>> Hi, I was wondering if anyone could point me in the right direction as >>>> far as the best way to use python to update html. >>> >>> There are a number of modules in the standard library that can help but >>> the best known module for this is BeautifulSoup >> >> I would call that statement highly exaggerated. >> >> http://blog.ianbicking.org/2008/03/30/python-html-parser-performance/ > > There may be a language thing at work here but by "best known module" > I do not mean Beautiful Soup is the best of all known modules, rather it > is the module which is most widely known of the non standard HTML > packages. I think "non standard HTML package" pretty much hits the nail on the head. > It is also, arguably, one of the easiest to use > and well behaved with non compliant html That, again, is questionable. The task at hand was to "update HTML pages", in which case it is quite useful to have them fixed up into standard compliant HTML before working on them. BeautifulSoup will not do that for you. Instead, it will leave you with whatever tag soup you had at the beginning, so that you will end up sending out broken HTML again. I wouldn't call that "well behaved" at all. Stefan _______________________________________________ Tutor maillist - Tutor <at> python.org http://mail.python.org/mailman/listinfo/tutor
On Tue, 2009-09-01 at 04:27 +0200, Luke Paireepinart wrote: > there are directions on how to remove yourself from the list at the > bottom of every message that the list sends out. > _______________________________________________ > click. > _______________________________________________ > Tutor maillist - Tutor <at> python.org > http://mail.python.org/mailman/listinfo/tutor May I suggest, to slightly tweak the signature of the ML with something like: --- Tutor mailing list - tutor <at> python.org Configuration options (including unsubscribing): http://mail.python.org/mailman/listinfo/tutor --- so that the less tech-savvy among the subscribers get a better hint on how to manage by themselves? Mac. _______________________________________________ Tutor maillist - Tutor <at> python.org http://mail.python.org/mailman/listinfo/tutor
On Tue, Sep 1, 2009 at 4:30 AM, Mac Ryan<quasipedia <at> gmail.com> wrote: > May I suggest, > > to slightly tweak the signature of the ML with something like: > > --- > Tutor mailing list - tutor <at> python.org > Configuration options (including unsubscribing): > http://mail.python.org/mailman/listinfo/tutor > --- Good idea, see below (I hope) Kent _______________________________________________ Tutor maillist - Tutor <at> python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
2009/9/1 Luke Paireepinart <rabidpoobear <at> gmail.com>: >>>> txt = "Hi how are you?" >>>> " ".join(txt.strip().split()) > 'Hi how are you?' txt.strip() only remove leading and trailing white space so does nothing in your example. However it works because txt.split() removes the excessive white space between the text. >>> txt 'Hi how are you?' >>> ' '.join(txt.split()) 'Hi how are you?' Greets Sander _______________________________________________ Tutor maillist - Tutor <at> python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
On Mon, Aug 31, 2009 at 9:43 PM, Ishan Puri<ballerz4ishi <at> sbcglobal.net> wrote: > Hello, > I have 2 plain text documents that have uneven spacing. I need to make > these single spaced between lines and between words. Basically I need to get > them to be equal character length after I abridge the uneven spacing. I don't know what you mean by "equal character length" here. > In > Python there is probably one simple command for this for a text file? How do > I do this? > E.G.: Hi how are you? > Fixed: Hi how are you? Another way to do this is with regular expressions, for example In [1]: import re In [2]: txt = "Hi how are you?" In [4]: txt = re.sub(r' +', ' ', txt) In [5]: txt Out[5]: 'Hi how are you?' You can also replace multiple newlines with single newlines. The details of that will depend on the line endings in your text; assuming \n for newline then you could use txt = re.sub(r'\n\n+', '\n', txt) to remove extra newlines. The split() method won't distinguish between spaces and newlines so you have to apply it one line at a time. The re.sub() method can work on the entire text at once. Kent _______________________________________________ Tutor maillist - Tutor <at> python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
Hi again,
The question might be a tad confusing, but what I want to ask is, if it's possible to track if and when a variable in an application has changed, and then grab the new content of that variable?
I have my product inventory database application which is attached to another bigger application. Some of the data I need comes from that bigger application, like for instance Consumer information (not handled by the application that I'm working on). So, if the address of a consumer is changed, how my application track the changes without having to do something like:
class Consumer(objectOfSomething):
-----
-----
def updateConsumerInfo(newAddress):
newAddress = newAddress
inventory.updateConsumerInfo(newAddress) #<<<not updating from here
instead only read from class:
class Consumer(objectOfSomething):
-----
-----
def updateConsumerInfo(newAddress):
newAddress = newAddress
and track the change of newAddress from the function updateConsumerInfo in class Consumer.
Is this possible to do? (if my question even make sense)
Thanks for any responses!
Best,
Krissy
_______________________________________________ Tutor maillist - Tutor <at> python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor
RSS Feed329 | |
|---|---|
609 | |
511 | |
402 | |
422 | |
343 | |
297 | |
647 | |
784 | |
524 | |
500 | |
321 | |
436 | |
334 | |
358 | |
607 | |
403 | |
504 | |
896 | |
553 | |
382 | |
539 | |
433 | |
498 | |
552 | |
464 | |
543 | |
567 | |
719 | |
607 | |
602 | |
636 | |
903 | |
737 | |
616 | |
541 | |
407 | |
421 | |
583 | |
753 | |
420 | |
418 | |
694 | |
632 | |
573 | |
457 | |
790 | |
703 | |
542 | |
622 | |
633 | |
743 | |
918 | |
454 | |
390 | |
553 | |
527 | |
587 | |
702 | |
666 | |
454 | |
609 | |
592 | |
483 | |
588 | |
486 | |
545 | |
765 | |
776 | |
734 | |
943 | |
489 | |
524 | |
469 | |
525 | |
665 | |
657 | |
424 | |
793 | |
946 | |
590 | |
663 | |
532 | |
477 | |
446 | |
747 | |
669 | |
594 | |
636 | |
514 | |
913 | |
909 | |
780 | |
834 | |
779 | |
573 | |
776 | |
896 | |
816 | |
929 | |
920 | |
855 | |
689 | |
766 | |
535 | |
807 | |
591 | |
434 | |
302 | |
587 | |
416 | |
532 | |
658 | |
644 | |
551 | |
578 | |
498 | |
655 | |
651 | |
908 | |
717 | |
482 | |
520 | |
707 | |
825 | |
602 | |
703 | |
626 | |
641 | |
931 | |
764 | |
524 | |
574 | |
465 | |
9 | |
1 | |
1 | |
1 |