Replace "\n" with n in Python scripts

This commit is contained in:
Benjamin Loison 2023-07-28 14:52:41 +02:00
parent b60bb22112
commit 5185bcb6a7
Signed by: Benjamin_Loison
SSH Key Fingerprint: SHA256:BtnEgYTlHdOg1u+RmYcDE0mnfz1rhv5dSbQ2gyxW8B8
2 changed files with 2 additions and 2 deletions

View File

@ -19,7 +19,7 @@ for channelId in list(os.walk('.'))[1]:
filePath = f'{channelId}/requests/{str(numberOfRequests - 1)}.json' filePath = f'{channelId}/requests/{str(numberOfRequests - 1)}.json'
with open(filePath) as f: with open(filePath) as f:
print(filePath) print(filePath)
#content = "\n".join(f.read().splitlines()[1:]) #content = '\n'.join(f.read().splitlines()[1:])
data = json.load(f)#json.loads(content) data = json.load(f)#json.loads(content)
snippet = data['items'][-1]['snippet'] snippet = data['items'][-1]['snippet']
if 'topLevelComment' in snippet: if 'topLevelComment' in snippet:

View File

@ -27,7 +27,7 @@ def write(s):
read = f.read() read = f.read()
# We are appening content, as we moved in-file cursor. # We are appening content, as we moved in-file cursor.
if read != '': if read != '':
f.write("\n") f.write('\n')
f.write(s) f.write(s)
f.flush() f.flush()
fcntl.flock(f, fcntl.LOCK_UN) fcntl.flock(f, fcntl.LOCK_UN)