// ....
PreparedStatement stat = c.prepareStatement("INSERT INTO snippets (snippetTitle, snippetCode, snippetDescr) VALUES (?,?,?)");
stat.setString(1,snippet.getSnippetTitle());
stat.setString(2,snippet.getSnippetCode());
stat.setString(3, snippet.getSnippetDescription());
stat.executeUpdate();
// ....
>>> s='YwAAAAAAAAAAAgAAAEAAAABzWAAAAGQAAGQBAGwAAG0BAFoBAAFkAABkAgBsAgBaAgBkAwCEAABaAwBkBACEAABaBABlBQBkBQCDAQBaBgBlAwBlBgCDAQByVABlBABlBgCDAQBHSG4AAGQCAFMoBgAAAGn/////KAEAAAB0AwAAAEFFU05jAQAAAAQAAAAFAAAAQwAAAHNfAAAAZAEAZAIAZAMAZAQAZAUAZwUAfQEAeEMAdAAAfAAAagEAZAYAgwEAgwEARF0sAFwCAH0CAH0DAHQCAHwBAHwCABmDAQB0AwB8AwCDAQBrAwByKwB0BABTcSsAV3QFAFMoBwAAAE5zCwAAADE3OTAgKyAxNTQzcwgAAAAxMjM0ICogM3MLAAAAOTk5OSAtIDEzMzdzCQAAADIwNDggLy8gMnMGAAAAMyAqKiA4dAEAAAAtKAYAAAB0CQAAAGVudW1lcmF0ZXQFAAAAc3BsaXR0BAAAAGV2YWx0AwAAAGludHQFAAAARmFsc2V0BAAAAFRydWUoBAAAAHQGAAAAc2VyaWFsdAsAAABleHByZXNzaW9uc3QFAAAAaW5kZXh0BQAAAHZhbHVlKAAAAAAoAAAAAHMIAAAAPHN0cmluZz50BQAAAGNoZWNrBgAAAHMKAAAAAAEVASIBHAEIAWMBAAAAAwAAAAMAAABDAAAAczcAAAB0AABqAQB8AAB0AABqAgCDAgB9AQB8AQBqAwB0BABqBQBkAQCDAQCDAQB9AgB8AgBqBgCDAABTKAIAAABOcywAAAAwUDhwVjBHNldscVV4dXVLTmsreTRONVBUZmFtR0FsbjlnRGhYRHhpNXJNPSgHAAAAUgAAAAB0AwAAAG5ld3QIAAAATU9ERV9FQ0J0BwAAAGRlY3J5cHR0BgAAAGJhc2U2NHQJAAAAYjY0ZGVjb2RldAUAAABzdHJpcCgDAAAAUggAAAB0BgAAAGNpcGhlcnQHAAAAZGVjb2RlZCgAAAAAKAAAAABzCAAAADxzdHJpbmc+dA0AAABnZW5lcmF0ZV9mbGFnDQAAAHMGAAAAAAEVARgBcw4AAABlbnRlciBzZXJpYWw6ICgHAAAAdA0AAABDcnlwdG8uQ2lwaGVyUgAAAABSEAAAAFIMAAAAUhUAAAB0CQAAAHJhd19pbnB1dFIIAAAAKAAAAAAoAAAAACgAAAAAcwgAAAA8c3RyaW5nPnQIAAAAPG1vZHVsZT4DAAAAcwwAAAAQAQwCCQcJBQwBDAE='
>>> import base64
>>> import marshal
>>> b= marshal.loads(base64.b64decode(s))
>>> import dis
>>> dis.dis(b)
3 0 LOAD_CONST 0 (-1)
3 LOAD_CONST 1 (('AES',))
6 IMPORT_NAME 0 (Crypto.Cipher)
9 IMPORT_FROM 1 (AES)
12 STORE_NAME 1 (AES)
15 POP_TOP
4 16 LOAD_CONST 0 (-1)
19 LOAD_CONST 2 (None)
22 IMPORT_NAME 2 (base64)
25 STORE_NAME 2 (base64)
6 28 LOAD_CONST 3 (<code object check at 0x105d2fd30, file "<string>", line 6>)
31 MAKE_FUNCTION 0
34 STORE_NAME 3 (check)
13 37 LOAD_CONST 4 (<code object generate_flag at 0x105d2fe30, file "<string>", line 13>)
40 MAKE_FUNCTION 0
43 STORE_NAME 4 (generate_flag)
18 46 LOAD_NAME 5 (raw_input)
49 LOAD_CONST 5 ('enter serial: ')
52 CALL_FUNCTION 1
55 STORE_NAME 6 (serial)
19 58 LOAD_NAME 3 (check)
61 LOAD_NAME 6 (serial)
64 CALL_FUNCTION 1
67 POP_JUMP_IF_FALSE 84
20 70 LOAD_NAME 4 (generate_flag)
73 LOAD_NAME 6 (serial)
76 CALL_FUNCTION 1
79 PRINT_ITEM
80 PRINT_NEWLINE
81 JUMP_FORWARD 0 (to 84)
>> 84 LOAD_CONST 2 (None)
87 RETURN_VALUE
>>>
Last login: Mon Aug 27 20:05:38 on ttys000
MacBook-Pro:~ leah$ host xxxx.ru
xxxx.ru has address 500.100.100.97
xxxx.ru mail is handled by 10 mail.xxxx.ru.
MacBook-Pro:~ leah$
import sys
import json
notFirst = False
print("[") # start json array
for data in sys.stdin:
(name,text) = data.strip().split("|") # split line
obj = dict(name=name, text=text) # to dict()
if notFirst: # avoid first comma for object
print(",", end='')
print(json.dumps(obj, ensure_ascii=False)) # dump json object
notFirst = True
print("]") # end json array
cat mydatafile.txt | python3 txttojson.py > mydatafile.json
[
{"text": "Не ела и не курила", "name": "Лошадь"}
,{"text": "Бездушна как всегда", "name": "Розетка"}
,{"text": "Тоже человек", "name": "Насос"}
]