- 1). Compute the value of the string you want to output and assign it to a Python variable, as in the following sample code:
myString = "Average programmer salary" - 2). Add the CR control character to the end of the string by using Python's "+" string concatenation operator:
myCRString = myString+'\r' - 3). Add the LF control character to the end of the string by using Python's "+" string concatenation operator:
myCRLFString = myCRString+'\n'
In the example, variable "myCRLFString" contains the initial string value with CR and LF added for correct output.
previous post