I have a blob with data like this
2324
2321
2132
How do I add a new value in this blob? So if I add ‘2200’, it becomes
2324
2321
2132
2200
I have tried append.block()
but that gives the error
Exception: ResourceExistsError: The blob type is invalid for this operation. RequestId:16a8f0f9-001e- Time:2023-02-24T05:05:16.1581160Z ErrorCode:InvalidBlobType
blob_client = container_client.get_blob_client("LIST.txt")
blob_client.append_block('5231n')
stuff = blob_client.download_blob().readall()
ans = stuff.decode('utf-8')
ans_list = ans.split('rn')
# print(ans_list)
for an in ans_list:
if an == '5231':
print("Num Exists")
2
Answers
There are 3 ways by which you can add data to an existing blob:
I have followed Document1 and SO-thread:
I have taken a file as below:
Then Uploaded it to storage account:
Then executed the below code :
Output:
2200 got added as below: