I'm trying to open a file, and edit a specific line. When I concatenate a character onto one of the lines, it works, but inserts a new line. However I don't want a new line. Here is the code:
def moveCurlyInline(line, i):
with open('test.js', 'r') as inputFile:
data = inputFile.readlines()
print(data[0])
print(data[0] + ' {')
The print outputs:
function hello()
then:
function hello()
{
I need the curly bracket to be on the same line as the function hello. Any idea what's wrong with my code?