How to change the content of a string in python -
How to change the content of a string in python -
i have blog in next website http://ecosdobigbang.com/ i'll post material relevant physics students speak portuguese (the target audience of post physics students in lusophone developing countries since have lot of difficulties in getting material).
to end utilize next python script coded luca trevisan http://lucatrevisan.wordpress.com/latex-to-wordpress/download/ allows 1 write latex file converted wordpress.com friendly html.
i never learned how code in python through trial , error able create few little modifications made final html output more liking.
nevertheless there 1 thing want i've not able far. when latex file i'm able utilize portuguese class , commands utilize natively translated portuguese in latex file, when run script html output uses english language name theorem environments.
after digging lot on web i've decided quit , inquire help. want able modify python script next theorem environments have portuguese name
axiom -> axiom theorem -> teorema lemma -> lema etc...
it seems me place need alter code in next lines:
def convertbeginnamedthm(thname,thm) : global inthm count[t[thm]] +=1 inthm = thm t = beginnamedthm.replace("_thmtype_",thm.capitalize()) t = t.replace("_thmnumb_",str(count[t[thm]])) t = t.replace("_thmname_",thname) return(t) def convertbeginthm(thm) : global inthm count[t[thm]] +=1 inthm = thm t = beginthm.replace("_thmtype_",thm.capitalize()) t = t.replace("_thmnumb_",str(count[t[thm]])) return(t)
but no matter i'm not able have final output want.
sorry bother such question, problem defeats me.
a quick , dirty approach (tested example.tex
provided python script) add
t = t.replace("theorem", "teorema") t = t.replace("lemma", "lema")
in function convertbeginthm
before return (t)
.
python string physics
Comments
Post a Comment