Carsten Dominik <domi...@uva.nl> writes: > On Jul 20, 2010, at 1:03 PM, Giovanni Ridolfi wrote: > >> Carsten Dominik <domi...@uva.nl> writes: >> >> >>> a python question: How do I prefix every line in a multiline string >>> with a string. For example, I would like to add "> " before all >>> lines >>> in a string.... >> >> how about replacing "\n" with "\n > " ? > > Please show me the full line of code, I am currently editing a python > script without any knowledge of python... > > :(
Carsten , I do not know python as well :-/ I found: 1. from python docs: http://docs.python.org/library/string.html string.replace(str, old, new[, maxreplace]) Return a copy of string str with all occurrences of substring old replaced by new. If the optional argument maxreplace is given, the first maxreplace occurrences are replaced. 2. while googling: "Python like this: python -c 'import sys; print sys.stdin.read().replace("\n", " ")' < days.txt" http://linux.dsplabs.com.au/rmnl-remove-new-line-characters-tr-awk-perl-sed-c-cpp-bash-python-xargs-ghc-ghci-haskell-sam-ssam-p65/ 3. also: http://bytes.com/topic/python/answers/721547-replace-characters-string # >>> s = "sex_m-designer_bw-size_42" # >>> s = s.replace('_', '=') # >>> s = s.replace('-', '&') # >>> s # 'sex=m&designer=bw&size=42' 4. http://stackoverflow.com/questions/930303/python-string-cleanup-manipulation-accented-characters name-of-the-string.replace(' ', '.') # replace spaces with periods hth Giovanni _______________________________________________ Emacs-orgmode mailing list Please use `Reply All' to send replies to the list. Emacs-orgmode@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-orgmode