I want to write something as one line such as:
Blah blah 123456 0.0000123
I used the below code:
value1 = 123456
value2 = 0.0000123
k = "Blah blah" + value1 +value2
File.write(k)
#outFile.write("Blah blah %s %s" % (value1 ,value2) )
The output is always:
Blah blah 123456
0.0000123
Integers when concatenated with strings have an assumed endline character afterwards. To remedy this problem, you can convert these ints to strings before concatenating all of them. You can do this with the str() function which is written about here: https://docs.python.org/2/library/functions.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With