问:
macOS Catalina: Python Quit unexpectedly error
I just upgraded to macOS Catalina from Mojave on my Macbook and tried to run a python3 script from terminal as follows: python3 scriptname.py
I get no response in the terminal and then error comes up : Python Quit unexpectedly with the following report: Please help me solve this or how do i downgrade to mojave as i need this to work

```Process:               Python [2726]
Path:                  /Library/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python
Identifier:            Python
Version:               3.7.4 (3.7.4)
Code Type:             X86-64 (Native)
Parent Process:        Python [2723]
Responsible:           Terminal [1574]
User ID:               501

Date/Time:             2020-01-23 23:24:33.722 +0000
OS Version:            Mac OS X 10.15.2 (19C57)
Report Version:        12
Anonymous UUID:        xxxx

Time Awake Since Boot: 1700 seconds

System Integrity Protection: enabled

Crashed Thread:        1  Dispatch queue: com.apple.root.default-qos

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000110
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [2726]

VM Regions Near 0x110:
-->
    __TEXT                 0000000109159000-000000010915a000 [    4K] r-x/rwx SM=COW  /Library/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python

Application Specific Information:
crashed on child side of fork pre-exec
Invalid dylib load. Clients should not load the unversioned libcrypto dylib as it does not have a stable ABI.

Thread 0:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib          0x00007fff65580ce6 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fff65642185 _pthread_cond_wait + 701
2   org.python.python               0x0000000109281cfd PyThread_acquire_lock_timed + 413
3   org.python.python               0x00000001092cb20f acquire_timed + 111
4   org.python.python               0x00000001092cb320 lock_PyThread_acquire_lock + 48
5   org.python.python               0x00000001091841dd _PyMethodDef_RawFastCallKeywords + 685
6   org.python.python               0x0000000109189d42 _PyMethodDescr_FastCallKeywords + 82
7   org.python.python               0x00000001092428ec call_function + 780
8   org.python.python               0x000000010923f873 _PyEval_EvalFrameDefault + 25155
9   org.python.python               0x0000000109243413 _PyEval_EvalCodeWithName + 2467
10  org.python.python               0x00000001091835a1 _PyFunction_FastCallKeywords + 257
11  org.python.python               0x00000001092428c2 call_function + 738
12  org.python.python               0x000000010923f873 _PyEval_EvalFrameDefault + 25155
13  org.python.python               0x0000000109243413 _PyEval_EvalCodeWithName + 2467
14  org.python.python               0x00000001091835a1 _PyFunction_FastCallKeywords + 257
15  org.python.python               0x00000001092428c2 call_function + 738
16  org.python.python               0x000000010923f873 _PyEval_EvalFrameDefault + 25155
17  org.python.python               0x0000000109183a10 function_code_fastcall + 128
18  org.python.python               0x0000000109183004 _PyFunction_FastCallDict + 148
19  org.python.python               0x000000010923fb9e _PyEval_EvalFrameDefault + 25966
20  org.python.python               0x0000000109183a10 function_code_fastcall + 128
21  org.python.python               0x00000001092428c2 call_function + 738
22  org.python.python               0x000000010923f873 _PyEval_EvalFrameDefault + 25155
23  org.python.python               0x0000000109183a10 function_code_fastcall + 128
24  org.python.python               0x00000001092428c2 call_function + 738
25  org.python.python               0x000000010923f873 _PyEval_EvalFrameDefault + 25155
26  org.python.python               0x0000000109183a10 function_code_fastcall + 128
27  org.python.python               0x00000001092428c2 call_function + 738
28  org.python.python               0x000000010923f873 _PyEval_EvalFrameDefault + 25155
29  org.python.python               0x0000000109183a10 function_code_fastcall + 128
30  org.python.python               0x0000000109183004 _PyFunction_FastCallDict + 148
31  org.python.python               0x00000001091844bf _PyObject_Call_Prepend + 143
32  org.python.python               0x00000001091d2d61 slot_tp_init + 145
33  org.python.python               0x00000001091ce749 type_call + 297
34  org.python.python               0x00000001091833f1 _PyObject_FastCallKeywords + 433
35  org.python.python               0x0000000109242784 call_function + 420
36  org.python.python               0x000000010923f92e _PyEval_EvalFrameDefault + 25342
37  org.python.python               0x0000000109183a10 function_code_fastcall + 128
38  org.python.python               0x00000001092428c2 call_function + 738
39  org.python.python               0x000000010923f88d _PyEval_EvalFrameDefault + 25181
40  org.python.python               0x0000000109183a10 function_code_fastcall + 128
41  org.python.python               0x00000001092428c2 call_function + 738
42  org.python.python               0x000000010923f88d _PyEval_EvalFrameDefault + 25181
43  org.python.python               0x0000000109183a10 function_code_fastcall + 128
44  org.python.python               0x00000001092428c2 call_function + 738
45  org.python.python               0x000000010923f873 _PyEval_EvalFrameDefault + 25155
46  org.python.python               0x0000000109243413 _PyEval_EvalCodeWithName + 2467
47  org.python.python               0x0000000109239554 PyEval_EvalCode + 100
48  org.python.python               0x0000000109276c31 PyRun_FileExFlags + 209
49  org.python.python               0x00000001092764aa PyRun_SimpleFileExFlags + 890
50  org.python.python               0x0000000109295903 pymain_main + 6915
51  org.python.python               0x0000000109295e6a _Py_UnixMain + 58
52  libdyld.dylib                   0x00007fff6543d7fd start + 1

Thread 1 Crashed:: Dispatch queue: com.apple.root.default-qos
0   libdispatch.dylib               0x00007fff653f4a29 dispatch_apply_f + 749
1   com.apple.CoreFoundation        0x00007fff2dd9598f __104-[CFPrefsSearchListSource synchronouslySendDaemonMessage:andAgentMessage:andDirectMessage:replyHandler:]_block_invoke.119 + 97
2   com.apple.CoreFoundation        0x00007fff2dd9591d CFPREFERENCES_IS_WAITING_FOR_SYSTEM_AND_USER_CFPREFSDS + 74
3   com.apple.CoreFoundation        0x00007fff2dd957b7 -[CFPrefsSearchListSource synchronouslySendDaemonMessage:andAgentMessage:andDirectMessage:replyHandler:] + 172
4   com.apple.CoreFoundation        0x00007fff2dd942a3 -[CFPrefsSearchListSource alreadylocked_generationCountFromListOfSources:count:] + 215
5   com.apple.CoreFoundation        0x00007fff2dd93fe0 -[CFPrefsSearchListSource alreadylocked_getDictionary:] + 360
6   com.apple.CoreFoundation        0x00007fff2dd93c04 -[CFPrefsSearchListSource alreadylocked_copyValueForKey:] + 152
7   com.apple.CoreFoundation        0x00007fff2dd93b4c -[CFPrefsSource copyValueForKey:] + 47
8   com.apple.CoreFoundation        0x00007fff2dd93b0a __76-[_CFXPreferences copyAppValueForKey:identifier:container:configurationURL:]_block_invoke + 32
9   com.apple.CoreFoundation        0x00007fff2dd8ba1c __108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:]_block_invoke + 381
10  com.apple.CoreFoundation        0x00007fff2dd8b51f -[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:] + 364
11  com.apple.CoreFoundation        0x00007fff2dd8b2ae -[_CFXPreferences copyAppValueForKey:identifier:container:configurationURL:] + 145
12  com.apple.CoreFoundation        0x00007fff2dd8b1e3 _CFPreferencesCopyAppValueWithContainerAndConfiguration + 101
13  com.apple.SystemConfiguration   0x00007fff3b55901c SCDynamicStoreCopyProxiesWithOptions + 155
14  _scproxy.cpython-37m-darwin.so  0x000000010a5fc880 get_proxy_settings + 32
15  org.python.python               0x0000000109184225 _PyMethodDef_RawFastCallKeywords + 757
16  org.python.python               0x00000001091835da _PyCFunction_FastCallKeywords + 42
17  org.python.python               0x00000001092428b4 call_function + 724
18  org.python.python               0x000000010923f92e _PyEval_EvalFrameDefault + 25342
19  org.python.python               0x0000000109183a10 function_code_fastcall + 128
20  org.python.python               0x00000001092428c2 call_function + 738
21  org.python.python               0x000000010923f92e _PyEval_EvalFrameDefault + 25342
22  org.python.python               0x0000000109183a10 function_code_fastcall + 128
23  org.python.python               0x00000001092428c2 call_function + 738
24  org.python.python               0x000000010923f92e _PyEval_EvalFrameDefault + 25342
25  org.python.python               0x0000000109243413 _PyEval_EvalCodeWithName + 2467
26  org.python.python               0x00000001091835a1 _PyFunction_FastCallKeywords + 257
27  org.python.python               0x00000001092428c2 call_function + 738
28  org.python.python               0x000000010923f9d4 _PyEval_EvalFrameDefault + 25508
29  org.python.python               0x0000000109243413 _PyEval_EvalCodeWithName + 2467
30  org.python.python               0x00000001091835a1 _PyFunction_FastCallKeywords + 257
31  org.python.python               0x00000001092428c2 call_function + 738
32  org.python.python               0x000000010923f9d4 _PyEval_EvalFrameDefault + 25508
33  org.python.python               0x0000000109183a10 function_code_fastcall + 128
34  org.python.python               0x00000001092428c2 call_function + 738
35  org.python.python               0x000000010923f873 _PyEval_EvalFrameDefault + 25155
36  org.python.python               0x0000000109243413 _PyEval_EvalCodeWithName + 2467
37  org.python.python               0x000000010918317b _PyFunction_FastCallDict + 523
38  org.python.python               0x00000001091844bf _PyObject_Call_Prepend + 143
39  org.python.python               0x0000000109183707 PyObject_Call + 135
40  org.python.python               0x000000010923fb9e _PyEval_EvalFrameDefault + 25966
41  org.python.python               0x0000000109243413 _PyEval_EvalCodeWithName + 2467
42  org.python.python               0x00000001091835a1 _PyFunction_FastCallKeywords + 257
43  org.python.python               0x00000001092428c2 call_function + 738
44  org.python.python               0x000000010923f9d4 _PyEval_EvalFrameDefault + 25508
45  org.python.python               0x0000000109183a10 function_code_fastcall + 128
46  org.python.python               0x00000001092428c2 call_function + 738
47  org.python.python               0x000000010923f873 _PyEval_EvalFrameDefault + 25155
48  org.python.python               0x0000000109183a10 function_code_fastcall + 128
49  org.python.python               0x00000001092428c2 call_function + 738
50  org.python.python               0x000000010923f873 _PyEval_EvalFrameDefault + 25155
51  org.python.python               0x0000000109183a10 function_code_fastcall + 128
52  org.python.python               0x00000001092428c2 call_function + 738
53  org.python.python               0x000000010923f873 _PyEval_EvalFrameDefault + 25155
54  org.python.python               0x0000000109183a10 function_code_fastcall + 128
55  org.python.python               0x0000000109183004 _PyFunction_FastCallDict + 148
56  org.python.python               0x00000001091844bf _PyObject_Call_Prepend + 143
57  org.python.python               0x0000000109183707 PyObject_Call + 135
58  org.python.python               0x00000001092cab77 t_bootstrap + 71
59  org.python.python               0x0000000109281939 pythread_wrapper + 25
60  libsystem_pthread.dylib         0x00007fff65641e65 _pthread_start + 148
61  libsystem_pthread.dylib         0x00007fff6563d83b thread_start + 15

Thread 1 crashed with X86 Thread State (64-bit):
  rax: 0x000000010ac01040  rbx: 0x0000000000000100  rcx: 0x0000000000000000  rdx: 0x0000000000000001
  rdi: 0x00007fff653f439c  rsi: 0x00007fff8f281a00  rbp: 0x0000700003b579f0  rsp: 0x0000700003b57960
   r8: 0x000000010ac01040   r9: 0x000000010ac00080  r10: 0x000000010ac00000  r11: 0x000000010ac00080
  r12: 0x0000000000000001  r13: 0x000000010ac01040  r14: 0x00000000100008ff  r15: 0x000000010ac01000
  rip: 0x00007fff653f4a29  rfl: 0x0000000000010206  cr2: 0x000000010b87f020

Logical CPU:     0
Error Code:      0x02000131
Trap Number:     133

Binary Images:
       0x109159000 -        0x109159fff +org.python.python (3.7.4 - 3.7.4) <4B030EC4-815E-34B7-90E7-D0720C31E072> /Library/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python
       0x109162000 -        0x10933bfff +org.python.python (3.7.4, [c] 2001-2019 Python Software Foundation. - 3.7.4) <AC1AEBEB-FF5A-32AD-BAE0-C6A0BCA86B84> /Library/Frameworks/Python.framework/Versions/3.7/Python
       0x109779000 -        0x10977afff +_heapq.cpython-37m-darwin.so (0) <E8B35F18-1B5A-3C9E-B1F4-0BE0432459A2> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_heapq.cpython-37m-darwin.so
       0x10988a000 -        0x109893ff7 +_socket.cpython-37m-darwin.so (0) <7B684803-C0A8-34D7-81CE-7A4EE7DEA614> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_socket.cpython-37m-darwin.so
       0x1098a0000 -        0x1098a4fff +math.cpython-37m-darwin.so (0) <C780CA87-2A8D-342E-930E-7EDBB84B3896> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/math.cpython-37m-darwin.so
       0x1098ab000 -        0x1098aefff +select.cpython-37m-darwin.so (0) <473A1E84-EAC7-30DD-A0C0-111ECA9BC60A> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/select.cpython-37m-darwin.so
       0x10993d000 -        0x10994aff7 +_ssl.cpython-37m-darwin.so (0) <D1740549-C698-31F9-95C7-88A38F5385F5> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_ssl.cpython-37m-darwin.so
       0x10995b000 -        0x1099b3ff7 +libssl.1.1.dylib (0) <1DF55B16-0F3A-3620-A4C8-6CEDF39B9620> /Library/Frameworks/Python.framework/Versions/3.7/lib/libssl.1.1.dylib
       0x1099dc000 -        0x109bf21df +libcrypto.1.1.dylib (0) <34708DE8-CBA8-3112-91FA-3333E07F30DB> /Library/Frameworks/Python.framework/Versions/3.7/lib/libcrypto.1.1.dylib
       0x109cc2000 -        0x109cc6fff +_struct.cpython-37m-darwin.so (0) <2379780F-4AB4-394B-B5AB-55A517D6627E> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_struct.cpython-37m-darwin.so
       0x109ccf000 -        0x109cd2ff7 +binascii.cpython-37m-darwin.so (0) <58A5F4AD-285A-35E3-90C4-08A3D3D14BF2> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/binascii.cpython-37m-darwin.so
       0x109d56000 -        0x109d58ff7 +_hashlib.cpython-37m-darwin.so (0) <A6066959-BCC0-3790-9FB2-8B8A9ECBF097> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_hashlib.cpython-37m-darwin.so
       0x109d5d000 -        0x109d62ff7 +_blake2.cpython-37m-darwin.so (0) <5D4A9B1B-FE9F-34EA-BD75-7B3CDDBB7CD0> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_blake2.cpython-37m-darwin.so
       0x109d67000 -        0x109d77ff7 +_sha3.cpython-37m-darwin.so (0) <E32B9196-5FD3-38FF-BF4E-EF74519A0AFA> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_sha3.cpython-37m-darwin.so
       0x109d7d000 -        0x109d7dff7 +_bisect.cpython-37m-darwin.so (0) <A4FCF31A-2AA6-3EAC-AF46-2F2D10EC1AB1> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_bisect.cpython-37m-darwin.so
       0x109d80000 -        0x109d81ff7 +_random.cpython-37m-darwin.so (0) <7E1DAB2E-F4F2-3DDD-BD85-C74BC8983933> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_random.cpython-37m-darwin.so
       0x109dc5000 -        0x109dd3ff7 +_datetime.cpython-37m-darwin.so (0) <C1603837-F8C7-3FFF-8C6B-D527535D7535> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_datetime.cpython-37m-darwin.so
       0x109e5f000 -        0x109e60ff7 +_queue.cpython-37m-darwin.so (0) <B9D80A7C-A744-3A24-AA10-1CEF3CFFD022> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_queue.cpython-37m-darwin.so
       0x109eb5000 -        0x109fb2fff +unicodedata.cpython-37m-darwin.so (0) <B4AE629C-6564-3E2E-9A6E-AE586EE0AD79> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/unicodedata.cpython-37m-darwin.so
       0x109ff8000 -        0x10a0d5fff +_brotli.cpython-37m-darwin.so (???) <FE870EC2-3BBF-3BE0-9499-2E527750E6A9> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/_brotli.cpython-37m-darwin.so
       0x10a0e4000 -        0x10a0e7ff7 +zlib.cpython-37m-darwin.so (0) <993EF100-1498-3D6A-91FD-79558CAC8F13> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/zlib.cpython-37m-darwin.so
       0x10a2f7000 -        0x10a2f7ff7 +_opcode.cpython-37m-darwin.so (0) <11A650B3-FF7B-3DF1-81E2-A906553221C9> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_opcode.cpython-37m-darwin.so
       0x10a44b000 -        0x10a44cff7 +_posixsubprocess.cpython-37m-darwin.so (0) <11920A4C-3AD4-3C87-95E5-418D30950610> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_posixsubprocess.cpython-37m-darwin.so
       0x10a450000 -        0x10a460fff +_ctypes.cpython-37m-darwin.so (0) <B0740DFD-2C92-3A81-9E85-B7CAA9F7EF67> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_ctypes.cpython-37m-darwin.so
       0x10a4b1000 -        0x10a4b2ff7 +_bz2.cpython-37m-darwin.so (0) <F89816AF-0BA9-3228-BAE7-54BA0D68EF67> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_bz2.cpython-37m-darwin.so
       0x10a4b6000 -        0x10a4e6ff7 +_lzma.cpython-37m-darwin.so (0) <AEA78736-809A-3F3E-A2A3-BDA83B0ECBA8> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_lzma.cpython-37m-darwin.so
       0x10a4f0000 -        0x10a4f0fff +grp.cpython-37m-darwin.so (0) <CF2821DC-6D7D-36C4-9F67-5D20E43D70B2> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/grp.cpython-37m-darwin.so
       0x10a5c7000 -        0x10a5c8ff3 +_constant_time.abi3.so (0) <96047CA2-343F-3C1A-A7FC-D5E1A0B3EB93> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cryptography/hazmat/bindings/_constant_time.abi3.so
       0x10a5cb000 -        0x10a5e5ff7 +_cffi_backend.cpython-37m-darwin.so (0) <34A2EC26-072B-399C-9841-6AE90C845EA6> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/_cffi_backend.cpython-37m-darwin.so
       0x10a5fc000 -        0x10a5fcff7 +_scproxy.cpython-37m-darwin.so (0) <1C12C693-374D-3CDA-8235-D20E4F60F2D7> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_scproxy.cpython-37m-darwin.so
       0x10ae80000 -        0x10b0b39ab +_openssl.abi3.so (0) <64E0B359-C39F-3CCC-AE07-27BA9BFAEA82> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cryptography/hazmat/bindings/_openssl.abi3.so
       0x10b3a3000 -        0x10b3a8fff +_json.cpython-37m-darwin.so (0) <58573D55-4505-383C-89CE-7B16ED7981AD> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_json.cpython-37m-darwin.so
       0x10b6a7000 -        0x10b6aefff +_elementtree.cpython-37m-darwin.so (0) <BCBD7BDA-D6E4-3986-AE4F-BABD7C9F1B29> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_elementtree.cpython-37m-darwin.so
       0x10b6b8000 -        0x10b6e1ff7 +pyexpat.cpython-37m-darwin.so (0) <DFD21217-38D1-329A-844A-67778791E921> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/pyexpat.cpython-37m-darwin.so
       0x10b7c7000 -        0x10b7c7fff +_uuid.cpython-37m-darwin.so (0) <4283C23E-E755-3642-9450-F25DED17AE4D> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_uuid.cpython-37m-darwin.so
       0x10b7ca000 -        0x10b7cdfff +_csv.cpython-37m-darwin.so (0) <F629A3FE-5724-37C1-8940-6E5C172BFD77> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_csv.cpython-37m-darwin.so
       0x10b813000 -        0x10b826ff7 +_pickle.cpython-37m-darwin.so (0) <9C74285E-75A9-33BD-8836-AE129AFA3A86> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_pickle.cpython-37m-darwin.so
       0x10b832000 -        0x10b837ff7 +array.cpython-37m-darwin.so (0) <7934FE3A-C258-3F4F-AD15-47D5BE9FCE15> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/array.cpython-37m-darwin.so
       0x10e1b6000 -        0x10e246cb7  dyld (733.8) <EEA931D0-403E-3BC8-862A-CBA037DE4A74> /usr/lib/dyld
    0x7fff29b07000 -     0x7fff29b07fff  com.apple.Accelerate (1.11 - Accelerate 1.11) <EEBE6680-1AAB-3192-AA7C-450537B07F27> /System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate
    0x7fff29b1f000 -     0x7fff2a18afef  com.apple.vImage (8.1 - 524.2) <2BDE5231-B5ED-313E-918A-876ACE1C0FCF> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vImage.framework/Versions/A/vImage
    0x7fff2a18b000 -     0x7fff2a3f4fff  libBLAS.dylib (1303.60.1) <94F6B3C0-5039-3F66-8B2E-98791287E459> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
    0x7fff2a3f5000 -     0x7fff2a6e4ff7  libBNNS.dylib (144.40.3) <F15D7D9E-0B9F-34FF-B144-DCA264614C54> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBNNS.dylib
    0x7fff2a6e6000 -     0x7fff2aa8bfff  libLAPACK.dylib (1303.60.1) <DCC36295-FF39-35A1-8DF1-1E8A714E2265> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib
    0x7fff2aa8c000 -     0x7fff2aaa1ff8  libLinearAlgebra.dylib (1303.60.1) <E3C0CC64-906B-3B44-B8AA-3075BA20E161> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLinearAlgebra.dylib
    0x7fff2aaa2000 -     0x7fff2aaa7ff3  libQuadrature.dylib (7) <17EC31E3-3D77-3B5A-8ADD-6A3DBC1531E7> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libQuadrature.dylib
    0x7fff2aaa8000 -     0x7fff2ab18fff  libSparse.dylib (103) <350DAE1C-C990-343F-A98A-1B4317EAA869> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libSparse.dylib
    0x7fff2ab19000 -     0x7fff2ab2bfef  libSparseBLAS.dylib (1303.60.1) <8C0C7291-AC3A-3808-9D45-E359A5E03F0E> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libSparseBLAS.dylib
    0x7fff2ab2c000 -     0x7fff2ad05ffb  libvDSP.dylib (735.40.1) <BD49856D-39CE-397F-A069-63B2F0D79529> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvDSP.dylib
    0x7fff2ad06000 -     0x7fff2adc1fd7  libvMisc.dylib (735.40.1) <9C40AC77-59A4-3180-AA4F-8F13CABF02D9> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvMisc.dylib
    0x7fff2adc2000 -     0x7fff2adc2fff  com.apple.Accelerate.vecLib (3.11 - vecLib 3.11) <A8B35A80-7217-38B1-8A20-E8B4F73124F0> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/vecLib
    0x7fff2c4fd000 -     0x7fff2c889ff6  com.apple.CFNetwork (1121.1.2 - 1121.1.2) <CD7AA80C-C73B-39C7-AE03-A36BFB936F29> /System/Library/Frameworks/CFNetwork.framework/Versions/A/CFNetwork
    0x7fff2dd5e000 -     0x7fff2e1defe7  com.apple.CoreFoundation (6.9 - 1674.103) <D1F93A5F-5FB9-3088-BC16-36DBF58144C0> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
    0x7fff2f14e000 -     0x7fff2f14efff  com.apple.CoreServices (1069.11 - 1069.11) <DD05556D-DEF3-348D-878D-CA3AB5C91D66> /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
    0x7fff2f14f000 -     0x7fff2f1d4fff  com.apple.AE (838 - 838) <1D2A4944-20FA-372A-B8DE-01067521CF8C> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/AE
    0x7fff2f1d5000 -     0x7fff2f4b6ff7  com.apple.CoreServices.CarbonCore (1217 - 1217) <17EE58A1-232F-3E35-AC81-C88509A1CE8F> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore
    0x7fff2f4b7000 -     0x7fff2f504ffd  com.apple.DictionaryServices (1.2 - 323.3) <631AEDD4-9328-33A7-ACE5-5FDE790FE7FD> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/DictionaryServices.framework/Versions/A/DictionaryServices
    0x7fff2f505000 -     0x7fff2f50dfff  com.apple.CoreServices.FSEvents (1268.60.1 - 1268.60.1) <9C5A3C2D-CA76-329E-B80C-9CA1A1B1BE51> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/FSEvents.framework/Versions/A/FSEvents
    0x7fff2f50e000 -     0x7fff2f747ff0  com.apple.LaunchServices (1069.11 - 1069.11) <7D9167B7-8C60-3F42-BA15-8A85E6238FD2> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices
    0x7fff2f748000 -     0x7fff2f7e0ff9  com.apple.Metadata (10.7.0 - 2075.4) <E57FA2CF-3BD5-3947-84CC-976F192C07C7> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata
    0x7fff2f7e1000 -     0x7fff2f80eff7  com.apple.CoreServices.OSServices (1069.11 - 1069.11) <C7F894DA-EA68-3467-B004-1D6C7D58703A> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices
    0x7fff2f80f000 -     0x7fff2f876fff  com.apple.SearchKit (1.4.1 - 1.4.1) <644BE782-F3CA-3CC2-A062-5472ECC68230> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SearchKit.framework/Versions/A/SearchKit
    0x7fff2f877000 -     0x7fff2f89bff5  com.apple.coreservices.SharedFileList (131.3 - 131.3) <3B586025-C347-38CF-B89F-9942CB88AA79> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SharedFileList.framework/Versions/A/SharedFileList
    0x7fff300eb000 -     0x7fff300f1fff  com.apple.DiskArbitration (2.7 - 2.7) <8B55B221-DB4E-3CCD-B104-FC52A4127A66> /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration
    0x7fff30423000 -     0x7fff307ebff4  com.apple.Foundation (6.9 - 1674.103) <9D7DB588-6BDC-3D7B-B267-761D4ECC88A9> /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
    0x7fff30b62000 -     0x7fff30c05ffb  com.apple.framework.IOKit (2.0.2 - 1726.60.2) <65BD2F00-4BC5-3EF6-BF4D-DA1F0513E2B9> /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
    0x7fff34470000 -     0x7fff3447cffe  com.apple.NetFS (6.0 - 4.0) <C803F10A-5C01-365B-A988-64B021DCDDD5> /System/Library/Frameworks/NetFS.framework/Versions/A/NetFS
    0x7fff37042000 -     0x7fff3705efff  com.apple.CFOpenDirectory (10.15 - 220.40.1) <BD6064BC-F588-3A34-A70C-CF8B62CA04E0>
```

答:
Works for me, but the solution was easier:
Remark: openssl version can be different

brew install openssl
sudo ln -s /usr/local/Cellar/openssl/1.0.2s/lib/libssl.dylib  /usr/local/lib/libssl.dylib
sudo ln -s /usr/local/Cellar/openssl/1.0.2s/lib/libcrypto.dylib  /usr/local/lib/libcrypto.dylib

Body:
I just upgraded to macOS Catalina from Mojave on my Macbook and tried to run a python3 script from terminal as follows: python3 scriptname.py
I get no response in the terminal and then error comes up : Python Quit unexpectedly with the following report: Please help me solve this or how do i downgrade to mojave as i need this to work

Process:               Python [2726]
Path:                  /Library/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python
Identifier:            Python
Version:               3.7.4 (3.7.4)
Code Type:             X86-64 (Native)
Parent Process:        Python [2723]
Responsible:           Terminal [1574]
User ID:               501

Date/Time:             2020-01-23 23:24:33.722 +0000
OS Version:            Mac OS X 10.15.2 (19C57)
Report Version:        12
Anonymous UUID:        xxxx

Time Awake Since Boot: 1700 seconds

System Integrity Protection: enabled

Crashed Thread:        1  Dispatch queue: com.apple.root.default-qos

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x0000000000000110
Exception Note:        EXC_CORPSE_NOTIFY

Termination Signal:    Segmentation fault: 11
Termination Reason:    Namespace SIGNAL, Code 0xb
Terminating Process:   exc handler [2726]

VM Regions Near 0x110:
-->
    __TEXT                 0000000109159000-000000010915a000 [    4K] r-x/rwx SM=COW  /Library/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python

Application Specific Information:
crashed on child side of fork pre-exec
Invalid dylib load. Clients should not load the unversioned libcrypto dylib as it does not have a stable ABI.

Thread 0:: Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib          0x00007fff65580ce6 __psynch_cvwait + 10
1   libsystem_pthread.dylib         0x00007fff65642185 _pthread_cond_wait + 701
2   org.python.python               0x0000000109281cfd PyThread_acquire_lock_timed + 413
3   org.python.python               0x00000001092cb20f acquire_timed + 111
4   org.python.python               0x00000001092cb320 lock_PyThread_acquire_lock + 48
5   org.python.python               0x00000001091841dd _PyMethodDef_RawFastCallKeywords + 685
6   org.python.python               0x0000000109189d42 _PyMethodDescr_FastCallKeywords + 82
7   org.python.python               0x00000001092428ec call_function + 780
8   org.python.python               0x000000010923f873 _PyEval_EvalFrameDefault + 25155
9   org.python.python               0x0000000109243413 _PyEval_EvalCodeWithName + 2467
10  org.python.python               0x00000001091835a1 _PyFunction_FastCallKeywords + 257
11  org.python.python               0x00000001092428c2 call_function + 738
12  org.python.python               0x000000010923f873 _PyEval_EvalFrameDefault + 25155
13  org.python.python               0x0000000109243413 _PyEval_EvalCodeWithName + 2467
14  org.python.python               0x00000001091835a1 _PyFunction_FastCallKeywords + 257
15  org.python.python               0x00000001092428c2 call_function + 738
16  org.python.python               0x000000010923f873 _PyEval_EvalFrameDefault + 25155
17  org.python.python               0x0000000109183a10 function_code_fastcall + 128
18  org.python.python               0x0000000109183004 _PyFunction_FastCallDict + 148
19  org.python.python               0x000000010923fb9e _PyEval_EvalFrameDefault + 25966
20  org.python.python               0x0000000109183a10 function_code_fastcall + 128
21  org.python.python               0x00000001092428c2 call_function + 738
22  org.python.python               0x000000010923f873 _PyEval_EvalFrameDefault + 25155
23  org.python.python               0x0000000109183a10 function_code_fastcall + 128
24  org.python.python               0x00000001092428c2 call_function + 738
25  org.python.python               0x000000010923f873 _PyEval_EvalFrameDefault + 25155
26  org.python.python               0x0000000109183a10 function_code_fastcall + 128
27  org.python.python               0x00000001092428c2 call_function + 738
28  org.python.python               0x000000010923f873 _PyEval_EvalFrameDefault + 25155
29  org.python.python               0x0000000109183a10 function_code_fastcall + 128
30  org.python.python               0x0000000109183004 _PyFunction_FastCallDict + 148
31  org.python.python               0x00000001091844bf _PyObject_Call_Prepend + 143
32  org.python.python               0x00000001091d2d61 slot_tp_init + 145
33  org.python.python               0x00000001091ce749 type_call + 297
34  org.python.python               0x00000001091833f1 _PyObject_FastCallKeywords + 433
35  org.python.python               0x0000000109242784 call_function + 420
36  org.python.python               0x000000010923f92e _PyEval_EvalFrameDefault + 25342
37  org.python.python               0x0000000109183a10 function_code_fastcall + 128
38  org.python.python               0x00000001092428c2 call_function + 738
39  org.python.python               0x000000010923f88d _PyEval_EvalFrameDefault + 25181
40  org.python.python               0x0000000109183a10 function_code_fastcall + 128
41  org.python.python               0x00000001092428c2 call_function + 738
42  org.python.python               0x000000010923f88d _PyEval_EvalFrameDefault + 25181
43  org.python.python               0x0000000109183a10 function_code_fastcall + 128
44  org.python.python               0x00000001092428c2 call_function + 738
45  org.python.python               0x000000010923f873 _PyEval_EvalFrameDefault + 25155
46  org.python.python               0x0000000109243413 _PyEval_EvalCodeWithName + 2467
47  org.python.python               0x0000000109239554 PyEval_EvalCode + 100
48  org.python.python               0x0000000109276c31 PyRun_FileExFlags + 209
49  org.python.python               0x00000001092764aa PyRun_SimpleFileExFlags + 890
50  org.python.python               0x0000000109295903 pymain_main + 6915
51  org.python.python               0x0000000109295e6a _Py_UnixMain + 58
52  libdyld.dylib                   0x00007fff6543d7fd start + 1

Thread 1 Crashed:: Dispatch queue: com.apple.root.default-qos
0   libdispatch.dylib               0x00007fff653f4a29 dispatch_apply_f + 749
1   com.apple.CoreFoundation        0x00007fff2dd9598f __104-[CFPrefsSearchListSource synchronouslySendDaemonMessage:andAgentMessage:andDirectMessage:replyHandler:]_block_invoke.119 + 97
2   com.apple.CoreFoundation        0x00007fff2dd9591d CFPREFERENCES_IS_WAITING_FOR_SYSTEM_AND_USER_CFPREFSDS + 74
3   com.apple.CoreFoundation        0x00007fff2dd957b7 -[CFPrefsSearchListSource synchronouslySendDaemonMessage:andAgentMessage:andDirectMessage:replyHandler:] + 172
4   com.apple.CoreFoundation        0x00007fff2dd942a3 -[CFPrefsSearchListSource alreadylocked_generationCountFromListOfSources:count:] + 215
5   com.apple.CoreFoundation        0x00007fff2dd93fe0 -[CFPrefsSearchListSource alreadylocked_getDictionary:] + 360
6   com.apple.CoreFoundation        0x00007fff2dd93c04 -[CFPrefsSearchListSource alreadylocked_copyValueForKey:] + 152
7   com.apple.CoreFoundation        0x00007fff2dd93b4c -[CFPrefsSource copyValueForKey:] + 47
8   com.apple.CoreFoundation        0x00007fff2dd93b0a __76-[_CFXPreferences copyAppValueForKey:identifier:container:configurationURL:]_block_invoke + 32
9   com.apple.CoreFoundation        0x00007fff2dd8ba1c __108-[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:]_block_invoke + 381
10  com.apple.CoreFoundation        0x00007fff2dd8b51f -[_CFXPreferences(SearchListAdditions) withSearchListForIdentifier:container:cloudConfigurationURL:perform:] + 364
11  com.apple.CoreFoundation        0x00007fff2dd8b2ae -[_CFXPreferences copyAppValueForKey:identifier:container:configurationURL:] + 145
12  com.apple.CoreFoundation        0x00007fff2dd8b1e3 _CFPreferencesCopyAppValueWithContainerAndConfiguration + 101
13  com.apple.SystemConfiguration   0x00007fff3b55901c SCDynamicStoreCopyProxiesWithOptions + 155
14  _scproxy.cpython-37m-darwin.so  0x000000010a5fc880 get_proxy_settings + 32
15  org.python.python               0x0000000109184225 _PyMethodDef_RawFastCallKeywords + 757
16  org.python.python               0x00000001091835da _PyCFunction_FastCallKeywords + 42
17  org.python.python               0x00000001092428b4 call_function + 724
18  org.python.python               0x000000010923f92e _PyEval_EvalFrameDefault + 25342
19  org.python.python               0x0000000109183a10 function_code_fastcall + 128
20  org.python.python               0x00000001092428c2 call_function + 738
21  org.python.python               0x000000010923f92e _PyEval_EvalFrameDefault + 25342
22  org.python.python               0x0000000109183a10 function_code_fastcall + 128
23  org.python.python               0x00000001092428c2 call_function + 738
24  org.python.python               0x000000010923f92e _PyEval_EvalFrameDefault + 25342
25  org.python.python               0x0000000109243413 _PyEval_EvalCodeWithName + 2467
26  org.python.python               0x00000001091835a1 _PyFunction_FastCallKeywords + 257
27  org.python.python               0x00000001092428c2 call_function + 738
28  org.python.python               0x000000010923f9d4 _PyEval_EvalFrameDefault + 25508
29  org.python.python               0x0000000109243413 _PyEval_EvalCodeWithName + 2467
30  org.python.python               0x00000001091835a1 _PyFunction_FastCallKeywords + 257
31  org.python.python               0x00000001092428c2 call_function + 738
32  org.python.python               0x000000010923f9d4 _PyEval_EvalFrameDefault + 25508
33  org.python.python               0x0000000109183a10 function_code_fastcall + 128
34  org.python.python               0x00000001092428c2 call_function + 738
35  org.python.python               0x000000010923f873 _PyEval_EvalFrameDefault + 25155
36  org.python.python               0x0000000109243413 _PyEval_EvalCodeWithName + 2467
37  org.python.python               0x000000010918317b _PyFunction_FastCallDict + 523
38  org.python.python               0x00000001091844bf _PyObject_Call_Prepend + 143
39  org.python.python               0x0000000109183707 PyObject_Call + 135
40  org.python.python               0x000000010923fb9e _PyEval_EvalFrameDefault + 25966
41  org.python.python               0x0000000109243413 _PyEval_EvalCodeWithName + 2467
42  org.python.python               0x00000001091835a1 _PyFunction_FastCallKeywords + 257
43  org.python.python               0x00000001092428c2 call_function + 738
44  org.python.python               0x000000010923f9d4 _PyEval_EvalFrameDefault + 25508
45  org.python.python               0x0000000109183a10 function_code_fastcall + 128
46  org.python.python               0x00000001092428c2 call_function + 738
47  org.python.python               0x000000010923f873 _PyEval_EvalFrameDefault + 25155
48  org.python.python               0x0000000109183a10 function_code_fastcall + 128
49  org.python.python               0x00000001092428c2 call_function + 738
50  org.python.python               0x000000010923f873 _PyEval_EvalFrameDefault + 25155
51  org.python.python               0x0000000109183a10 function_code_fastcall + 128
52  org.python.python               0x00000001092428c2 call_function + 738
53  org.python.python               0x000000010923f873 _PyEval_EvalFrameDefault + 25155
54  org.python.python               0x0000000109183a10 function_code_fastcall + 128
55  org.python.python               0x0000000109183004 _PyFunction_FastCallDict + 148
56  org.python.python               0x00000001091844bf _PyObject_Call_Prepend + 143
57  org.python.python               0x0000000109183707 PyObject_Call + 135
58  org.python.python               0x00000001092cab77 t_bootstrap + 71
59  org.python.python               0x0000000109281939 pythread_wrapper + 25
60  libsystem_pthread.dylib         0x00007fff65641e65 _pthread_start + 148
61  libsystem_pthread.dylib         0x00007fff6563d83b thread_start + 15

Thread 1 crashed with X86 Thread State (64-bit):
  rax: 0x000000010ac01040  rbx: 0x0000000000000100  rcx: 0x0000000000000000  rdx: 0x0000000000000001
  rdi: 0x00007fff653f439c  rsi: 0x00007fff8f281a00  rbp: 0x0000700003b579f0  rsp: 0x0000700003b57960
   r8: 0x000000010ac01040   r9: 0x000000010ac00080  r10: 0x000000010ac00000  r11: 0x000000010ac00080
  r12: 0x0000000000000001  r13: 0x000000010ac01040  r14: 0x00000000100008ff  r15: 0x000000010ac01000
  rip: 0x00007fff653f4a29  rfl: 0x0000000000010206  cr2: 0x000000010b87f020

Logical CPU:     0
Error Code:      0x02000131
Trap Number:     133

Binary Images:
       0x109159000 -        0x109159fff +org.python.python (3.7.4 - 3.7.4) <4B030EC4-815E-34B7-90E7-D0720C31E072> /Library/Frameworks/Python.framework/Versions/3.7/Resources/Python.app/Contents/MacOS/Python
       0x109162000 -        0x10933bfff +org.python.python (3.7.4, [c] 2001-2019 Python Software Foundation. - 3.7.4) <AC1AEBEB-FF5A-32AD-BAE0-C6A0BCA86B84> /Library/Frameworks/Python.framework/Versions/3.7/Python
       0x109779000 -        0x10977afff +_heapq.cpython-37m-darwin.so (0) <E8B35F18-1B5A-3C9E-B1F4-0BE0432459A2> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_heapq.cpython-37m-darwin.so
       0x10988a000 -        0x109893ff7 +_socket.cpython-37m-darwin.so (0) <7B684803-C0A8-34D7-81CE-7A4EE7DEA614> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_socket.cpython-37m-darwin.so
       0x1098a0000 -        0x1098a4fff +math.cpython-37m-darwin.so (0) <C780CA87-2A8D-342E-930E-7EDBB84B3896> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/math.cpython-37m-darwin.so
       0x1098ab000 -        0x1098aefff +select.cpython-37m-darwin.so (0) <473A1E84-EAC7-30DD-A0C0-111ECA9BC60A> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/select.cpython-37m-darwin.so
       0x10993d000 -        0x10994aff7 +_ssl.cpython-37m-darwin.so (0) <D1740549-C698-31F9-95C7-88A38F5385F5> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_ssl.cpython-37m-darwin.so
       0x10995b000 -        0x1099b3ff7 +libssl.1.1.dylib (0) <1DF55B16-0F3A-3620-A4C8-6CEDF39B9620> /Library/Frameworks/Python.framework/Versions/3.7/lib/libssl.1.1.dylib
       0x1099dc000 -        0x109bf21df +libcrypto.1.1.dylib (0) <34708DE8-CBA8-3112-91FA-3333E07F30DB> /Library/Frameworks/Python.framework/Versions/3.7/lib/libcrypto.1.1.dylib
       0x109cc2000 -        0x109cc6fff +_struct.cpython-37m-darwin.so (0) <2379780F-4AB4-394B-B5AB-55A517D6627E> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_struct.cpython-37m-darwin.so
       0x109ccf000 -        0x109cd2ff7 +binascii.cpython-37m-darwin.so (0) <58A5F4AD-285A-35E3-90C4-08A3D3D14BF2> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/binascii.cpython-37m-darwin.so
       0x109d56000 -        0x109d58ff7 +_hashlib.cpython-37m-darwin.so (0) <A6066959-BCC0-3790-9FB2-8B8A9ECBF097> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_hashlib.cpython-37m-darwin.so
       0x109d5d000 -        0x109d62ff7 +_blake2.cpython-37m-darwin.so (0) <5D4A9B1B-FE9F-34EA-BD75-7B3CDDBB7CD0> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_blake2.cpython-37m-darwin.so
       0x109d67000 -        0x109d77ff7 +_sha3.cpython-37m-darwin.so (0) <E32B9196-5FD3-38FF-BF4E-EF74519A0AFA> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_sha3.cpython-37m-darwin.so
       0x109d7d000 -        0x109d7dff7 +_bisect.cpython-37m-darwin.so (0) <A4FCF31A-2AA6-3EAC-AF46-2F2D10EC1AB1> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_bisect.cpython-37m-darwin.so
       0x109d80000 -        0x109d81ff7 +_random.cpython-37m-darwin.so (0) <7E1DAB2E-F4F2-3DDD-BD85-C74BC8983933> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_random.cpython-37m-darwin.so
       0x109dc5000 -        0x109dd3ff7 +_datetime.cpython-37m-darwin.so (0) <C1603837-F8C7-3FFF-8C6B-D527535D7535> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_datetime.cpython-37m-darwin.so
       0x109e5f000 -        0x109e60ff7 +_queue.cpython-37m-darwin.so (0) <B9D80A7C-A744-3A24-AA10-1CEF3CFFD022> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_queue.cpython-37m-darwin.so
       0x109eb5000 -        0x109fb2fff +unicodedata.cpython-37m-darwin.so (0) <B4AE629C-6564-3E2E-9A6E-AE586EE0AD79> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/unicodedata.cpython-37m-darwin.so
       0x109ff8000 -        0x10a0d5fff +_brotli.cpython-37m-darwin.so (???) <FE870EC2-3BBF-3BE0-9499-2E527750E6A9> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/_brotli.cpython-37m-darwin.so
       0x10a0e4000 -        0x10a0e7ff7 +zlib.cpython-37m-darwin.so (0) <993EF100-1498-3D6A-91FD-79558CAC8F13> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/zlib.cpython-37m-darwin.so
       0x10a2f7000 -        0x10a2f7ff7 +_opcode.cpython-37m-darwin.so (0) <11A650B3-FF7B-3DF1-81E2-A906553221C9> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_opcode.cpython-37m-darwin.so
       0x10a44b000 -        0x10a44cff7 +_posixsubprocess.cpython-37m-darwin.so (0) <11920A4C-3AD4-3C87-95E5-418D30950610> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_posixsubprocess.cpython-37m-darwin.so
       0x10a450000 -        0x10a460fff +_ctypes.cpython-37m-darwin.so (0) <B0740DFD-2C92-3A81-9E85-B7CAA9F7EF67> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_ctypes.cpython-37m-darwin.so
       0x10a4b1000 -        0x10a4b2ff7 +_bz2.cpython-37m-darwin.so (0) <F89816AF-0BA9-3228-BAE7-54BA0D68EF67> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_bz2.cpython-37m-darwin.so
       0x10a4b6000 -        0x10a4e6ff7 +_lzma.cpython-37m-darwin.so (0) <AEA78736-809A-3F3E-A2A3-BDA83B0ECBA8> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_lzma.cpython-37m-darwin.so
       0x10a4f0000 -        0x10a4f0fff +grp.cpython-37m-darwin.so (0) <CF2821DC-6D7D-36C4-9F67-5D20E43D70B2> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/grp.cpython-37m-darwin.so
       0x10a5c7000 -        0x10a5c8ff3 +_constant_time.abi3.so (0) <96047CA2-343F-3C1A-A7FC-D5E1A0B3EB93> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cryptography/hazmat/bindings/_constant_time.abi3.so
       0x10a5cb000 -        0x10a5e5ff7 +_cffi_backend.cpython-37m-darwin.so (0) <34A2EC26-072B-399C-9841-6AE90C845EA6> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/_cffi_backend.cpython-37m-darwin.so
       0x10a5fc000 -        0x10a5fcff7 +_scproxy.cpython-37m-darwin.so (0) <1C12C693-374D-3CDA-8235-D20E4F60F2D7> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_scproxy.cpython-37m-darwin.so
       0x10ae80000 -        0x10b0b39ab +_openssl.abi3.so (0) <64E0B359-C39F-3CCC-AE07-27BA9BFAEA82> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/cryptography/hazmat/bindings/_openssl.abi3.so
       0x10b3a3000 -        0x10b3a8fff +_json.cpython-37m-darwin.so (0) <58573D55-4505-383C-89CE-7B16ED7981AD> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_json.cpython-37m-darwin.so
       0x10b6a7000 -        0x10b6aefff +_elementtree.cpython-37m-darwin.so (0) <BCBD7BDA-D6E4-3986-AE4F-BABD7C9F1B29> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_elementtree.cpython-37m-darwin.so
       0x10b6b8000 -        0x10b6e1ff7 +pyexpat.cpython-37m-darwin.so (0) <DFD21217-38D1-329A-844A-67778791E921> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/pyexpat.cpython-37m-darwin.so
       0x10b7c7000 -        0x10b7c7fff +_uuid.cpython-37m-darwin.so (0) <4283C23E-E755-3642-9450-F25DED17AE4D> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_uuid.cpython-37m-darwin.so
       0x10b7ca000 -        0x10b7cdfff +_csv.cpython-37m-darwin.so (0) <F629A3FE-5724-37C1-8940-6E5C172BFD77> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_csv.cpython-37m-darwin.so
       0x10b813000 -        0x10b826ff7 +_pickle.cpython-37m-darwin.so (0) <9C74285E-75A9-33BD-8836-AE129AFA3A86> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/_pickle.cpython-37m-darwin.so
       0x10b832000 -        0x10b837ff7 +array.cpython-37m-darwin.so (0) <7934FE3A-C258-3F4F-AD15-47D5BE9FCE15> /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/lib-dynload/array.cpython-37m-darwin.so
       0x10e1b6000 -        0x10e246cb7  dyld (733.8) <EEA931D0-403E-3BC8-862A-CBA037DE4A74> /usr/lib/dyld
    0x7fff29b07000 -     0x7fff29b07fff  com.apple.Accelerate (1.11 - Accelerate 1.11) <EEBE6680-1AAB-3192-AA7C-450537B07F27> /System/Library/Frameworks/Accelerate.framework/Versions/A/Accelerate
    0x7fff29b1f000 -     0x7fff2a18afef  com.apple.vImage (8.1 - 524.2) <2BDE5231-B5ED-313E-918A-876ACE1C0FCF> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vImage.framework/Versions/A/vImage
    0x7fff2a18b000 -     0x7fff2a3f4fff  libBLAS.dylib (1303.60.1) <94F6B3C0-5039-3F66-8B2E-98791287E459> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
    0x7fff2a3f5000 -     0x7fff2a6e4ff7  libBNNS.dylib (144.40.3) <F15D7D9E-0B9F-34FF-B144-DCA264614C54> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBNNS.dylib
    0x7fff2a6e6000 -     0x7fff2aa8bfff  libLAPACK.dylib (1303.60.1) <DCC36295-FF39-35A1-8DF1-1E8A714E2265> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib
    0x7fff2aa8c000 -     0x7fff2aaa1ff8  libLinearAlgebra.dylib (1303.60.1) <E3C0CC64-906B-3B44-B8AA-3075BA20E161> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLinearAlgebra.dylib
    0x7fff2aaa2000 -     0x7fff2aaa7ff3  libQuadrature.dylib (7) <17EC31E3-3D77-3B5A-8ADD-6A3DBC1531E7> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libQuadrature.dylib
    0x7fff2aaa8000 -     0x7fff2ab18fff  libSparse.dylib (103) <350DAE1C-C990-343F-A98A-1B4317EAA869> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libSparse.dylib
    0x7fff2ab19000 -     0x7fff2ab2bfef  libSparseBLAS.dylib (1303.60.1) <8C0C7291-AC3A-3808-9D45-E359A5E03F0E> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libSparseBLAS.dylib
    0x7fff2ab2c000 -     0x7fff2ad05ffb  libvDSP.dylib (735.40.1) <BD49856D-39CE-397F-A069-63B2F0D79529> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvDSP.dylib
    0x7fff2ad06000 -     0x7fff2adc1fd7  libvMisc.dylib (735.40.1) <9C40AC77-59A4-3180-AA4F-8F13CABF02D9> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libvMisc.dylib
    0x7fff2adc2000 -     0x7fff2adc2fff  com.apple.Accelerate.vecLib (3.11 - vecLib 3.11) <A8B35A80-7217-38B1-8A20-E8B4F73124F0> /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/vecLib
    0x7fff2c4fd000 -     0x7fff2c889ff6  com.apple.CFNetwork (1121.1.2 - 1121.1.2) <CD7AA80C-C73B-39C7-AE03-A36BFB936F29> /System/Library/Frameworks/CFNetwork.framework/Versions/A/CFNetwork
    0x7fff2dd5e000 -     0x7fff2e1defe7  com.apple.CoreFoundation (6.9 - 1674.103) <D1F93A5F-5FB9-3088-BC16-36DBF58144C0> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
    0x7fff2f14e000 -     0x7fff2f14efff  com.apple.CoreServices (1069.11 - 1069.11) <DD05556D-DEF3-348D-878D-CA3AB5C91D66> /System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices
    0x7fff2f14f000 -     0x7fff2f1d4fff  com.apple.AE (838 - 838) <1D2A4944-20FA-372A-B8DE-01067521CF8C> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/AE.framework/Versions/A/AE
    0x7fff2f1d5000 -     0x7fff2f4b6ff7  com.apple.CoreServices.CarbonCore (1217 - 1217) <17EE58A1-232F-3E35-AC81-C88509A1CE8F> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/CarbonCore.framework/Versions/A/CarbonCore
    0x7fff2f4b7000 -     0x7fff2f504ffd  com.apple.DictionaryServices (1.2 - 323.3) <631AEDD4-9328-33A7-ACE5-5FDE790FE7FD> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/DictionaryServices.framework/Versions/A/DictionaryServices
    0x7fff2f505000 -     0x7fff2f50dfff  com.apple.CoreServices.FSEvents (1268.60.1 - 1268.60.1) <9C5A3C2D-CA76-329E-B80C-9CA1A1B1BE51> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/FSEvents.framework/Versions/A/FSEvents
    0x7fff2f50e000 -     0x7fff2f747ff0  com.apple.LaunchServices (1069.11 - 1069.11) <7D9167B7-8C60-3F42-BA15-8A85E6238FD2> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/LaunchServices
    0x7fff2f748000 -     0x7fff2f7e0ff9  com.apple.Metadata (10.7.0 - 2075.4) <E57FA2CF-3BD5-3947-84CC-976F192C07C7> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/Metadata.framework/Versions/A/Metadata
    0x7fff2f7e1000 -     0x7fff2f80eff7  com.apple.CoreServices.OSServices (1069.11 - 1069.11) <C7F894DA-EA68-3467-B004-1D6C7D58703A> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/OSServices.framework/Versions/A/OSServices
    0x7fff2f80f000 -     0x7fff2f876fff  com.apple.SearchKit (1.4.1 - 1.4.1) <644BE782-F3CA-3CC2-A062-5472ECC68230> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SearchKit.framework/Versions/A/SearchKit
    0x7fff2f877000 -     0x7fff2f89bff5  com.apple.coreservices.SharedFileList (131.3 - 131.3) <3B586025-C347-38CF-B89F-9942CB88AA79> /System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/SharedFileList.framework/Versions/A/SharedFileList
    0x7fff300eb000 -     0x7fff300f1fff  com.apple.DiskArbitration (2.7 - 2.7) <8B55B221-DB4E-3CCD-B104-FC52A4127A66> /System/Library/Frameworks/DiskArbitration.framework/Versions/A/DiskArbitration
    0x7fff30423000 -     0x7fff307ebff4  com.apple.Foundation (6.9 - 1674.103) <9D7DB588-6BDC-3D7B-B267-761D4ECC88A9> /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation
    0x7fff30b62000 -     0x7fff30c05ffb  com.apple.framework.IOKit (2.0.2 - 1726.60.2) <65BD2F00-4BC5-3EF6-BF4D-DA1F0513E2B9> /System/Library/Frameworks/IOKit.framework/Versions/A/IOKit
    0x7fff34470000 -     0x7fff3447cffe  com.apple.NetFS (6.0 - 4.0) <C803F10A-5C01-365B-A988-64B021DCDDD5> /System/Library/Frameworks/NetFS.framework/Versions/A/NetFS
    0x7fff37042000 -     0x7fff3705efff  com.apple.CFOpenDirectory (10.15 - 220.40.1) <BD6064BC-F588-3A34-A70C-CF8B62CA04E0>


来源: stackexchange

问:
Try to find a better way to layout 4 images
I have 4 images and try to layout them as my expections. I know there is a very easy way to layout with table layout like the following snippet.

```

But I don't want to do it with table layout for HTML Semantic reason. So How do I do it with CSS ?

答:
Check this. Hope it helps.

ul{text-align:center; width:200px;}
ul li{display:inline-block; vertical-align:top; width:50px}
ul li:first-child{clear:both;display: block; margin: 0 auto;}
ul li img{width:100%}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><ul>
  <li><img src="https://en.pimg.jp/015/085/802/1/15085802.jpg" /></li>
  <li><img src="https://en.pimg.jp/015/085/802/1/15085802.jpg" /></li>
  <li><img src="https://en.pimg.jp/015/085/802/1/15085802.jpg" /></li>
  <li><img src="https://en.pimg.jp/015/085/802/1/15085802.jpg" /></li>
</ul></code>```

ContentLicense: CC BY-SA 4.0

Body:
I have 4 images and try to layout them as my expections. I know there is a very easy way to layout with table layout like the following snippet.

But I don't want to do it with table layout for HTML Semantic reason. So How do I do it with CSS ?

Body:
Check this. Hope it helps.

ul{text-align:center; width:200px;}
ul li{display:inline-block; vertical-align:top; width:50px}
ul li:first-child{clear:both;display: block; margin: 0 auto;}
ul li img{width:100%}

<ul>
  <li><img src="https://en.pimg.jp/015/085/802/1/15085802.jpg" /></li>
  <li><img src="https://en.pimg.jp/015/085/802/1/15085802.jpg" /></li>
  <li><img src="https://en.pimg.jp/015/085/802/1/15085802.jpg" /></li>
  <li><img src="https://en.pimg.jp/015/085/802/1/15085802.jpg" /></li>
</ul>


问:
Must be initialized error in val variable
Following code report property must be initialized or be abstract error.

```<code>// MyApi.kt
interface MyApi {

    ...
}

// MyFetch.kt
class MyFetch {

    private val myApi: MyApi  // <- this line

    ...
}
</code>```

It can use lateinit statement in mutable variable, but how should I predefined in val?

答:
You actually have to initialize the variable on the time of object creation in the variable declairation itself or in the init{} block, since there is no preinit null type in the Kotlin.

And since your variable is val not var you cannot set it after created so there's no point of creating the variable.

If you meant to initialize the variable later on but only once, check this answer: https://stackoverflow.com/a/48445081/11377112
This is done by delegation like this:

```<code>class InitOnceProperty<T> : ReadWriteProperty<Any, T> {

    private object EMPTY

    private var value: Any? = EMPTY

    override fun getValue(thisRef: Any, property: KProperty<*>): T {
        if (value == EMPTY) {
            throw IllegalStateException("Value isn't initialized")
        } else {
            return value as T
        }
    }

    override fun setValue(thisRef: Any, property: KProperty<*>, value: T) {
        if (this.value != EMPTY) {
            throw IllegalStateException("Value is initialized")
        }
        this.value = value
    }
}
</code>```

Now you can delegate the variable by the delegate

```<code>var property: Int by InitOnceProperty()
</code>```

Body:
Following code report property must be initialized or be abstract error.

// MyApi.kt
interface MyApi {

    ...
}

// MyFetch.kt
class MyFetch {

    private val myApi: MyApi  // <- this line

    ...
}

It can use lateinit statement in mutable variable, but how should I predefined in val?

Body:
You actually have to initialize the variable on the time of object creation in the variable declairation itself or in the init{} block, since there is no preinit null type in the Kotlin.

And since your variable is val not var you cannot set it after created so there's no point of creating the variable.

If you meant to initialize the variable later on but only once, check this answer: https://stackoverflow.com/a/48445081/11377112
This is done by delegation like this:

class InitOnceProperty<T> : ReadWriteProperty<Any, T> {

    private object EMPTY

    private var value: Any? = EMPTY

    override fun getValue(thisRef: Any, property: KProperty<*>): T {
        if (value == EMPTY) {
            throw IllegalStateException("Value isn't initialized")
        } else {
            return value as T
        }
    }

    override fun setValue(thisRef: Any, property: KProperty<*>, value: T) {
        if (this.value != EMPTY) {
            throw IllegalStateException("Value is initialized")
        }
        this.value = value
    }
}

Now you can delegate the variable by the delegate

var property: Int by InitOnceProperty()


问:
Replace value in a node retaining the XML Structure using XSLT
I have a requirement where I need to replace the value of a node based on the attributes with a different value, retaining the original XML structure. Basically, I need to copy the whole XML only by replacing certain values when specific attributes are encountered in the original XML.

Below is a sample XML before transformation and after transformation.

Original XML:

```<code><root>
    <body>
        <node_level1>
            <node_level2>
                <node_level3>
                    <value animal="cat">Munchkin</value>
                </node_level3>
                <node_level3>
                    <value animal="cat">Turkish Angora</value>
                </node_level3>
                <node_level3>
                    <value animal="cat">La Perm</value>
                </node_level3>
            </node_level2>
            <node_level2>
                <node_level3>
                    <node_level4>
                        <value animal="dog">Siberian Husky</value>
                    </node_level4>
                    <node_level4>
                        <value animal="dog">Pug</value>
                    </node_level4>
                    <node_level4>
                        <value animal="dog">Beagle</value>
                    </node_level4>
                </node_level3>
            </node_level2>
        </node_level1>
    </body>
</root>
</code>```

After transforming the data using XSLT, I need the XML as below:

```<code><root>
    <body>
        <node_level1>
            <node_level2>
                <node_level3>
                    <value animal="cat">Cat Family</value>
                </node_level3>
                <node_level3>
                    <value animal="cat">Cat Family</value>
                </node_level3>
                <node_level3>
                    <value animal="cat">Cat Family</value>
                </node_level3>
            </node_level2>
            <node_level2>
                <node_level3>
                    <node_level4>
                        <value animal="dog">Dog Family</value>
                    </node_level4>
                    <node_level4>
                        <value animal="dog">Dog Family</value>
                    </node_level4>
                    <node_level4>
                        <value animal="dog">Dog Family</value>
                    </node_level4>
                </node_level3>
            </node_level2>
        </node_level1>
    </body>
</root>
</code>```

Here is the code that works for specified attributes, I need to generalize it.

```<code><?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="xsl" version="2.0">
    <xsl:template match="/">
        <root>
            <xsl:for-each select="//*[value[@animal = 'cat']]">
                <xsl:copy>
                    <xsl:value-of select="@*"/>
                    <xsl:value-of select="'Cat Family'"/>
                </xsl:copy>
            </xsl:for-each>
        </root>
    </xsl:template>
</xsl:stylesheet>
</code>```

答:
This is very simple task you need to use identity template to copy of all xml nodes as it  is:

```<code><xsl:template match="@* | node()">
    <xsl:copy>
        <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
</xsl:template>
</code>```

Then you can use a seperate template of value element as per your requirement:

```<code><xsl:template match="value">
    <xsl:choose>
        <xsl:when test="@animal = 'cat'">
            <value animal="cat">Cat Family</value>
        </xsl:when>
        <xsl:when test="@animal = 'dog'">
            <value animal="dog">Dog Family</value>
        </xsl:when>
    </xsl:choose>
</xsl:template>
</code>```

Final XSL file is :

```<code><?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="xsl" version="2.0">

    <!-- indent elements to see properly -->
    <xsl:output indent="yes"/>

    <xsl:template match="@* | node()">
        <xsl:copy>
            <xsl:apply-templates select="@* | node()"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="value">
        <xsl:choose>
            <xsl:when test="@animal = 'cat'">
                <value animal="cat">Cat Family</value>
            </xsl:when>
            <xsl:when test="@animal = 'dog'">
                <value animal="dog">Dog Family</value>
            </xsl:when>
        </xsl:choose>
    </xsl:template>

</xsl:stylesheet>
</code>```

Body:
I have a requirement where I need to replace the value of a node based on the attributes with a different value, retaining the original XML structure. Basically, I need to copy the whole XML only by replacing certain values when specific attributes are encountered in the original XML.

Below is a sample XML before transformation and after transformation.

Original XML:

<root>

        <node_level1>
            <node_level2>
                <node_level3>
                    <value animal="cat">Munchkin</value>
                </node_level3>
                <node_level3>
                    <value animal="cat">Turkish Angora</value>
                </node_level3>
                <node_level3>
                    <value animal="cat">La Perm</value>
                </node_level3>
            </node_level2>
            <node_level2>
                <node_level3>
                    <node_level4>
                        <value animal="dog">Siberian Husky</value>
                    </node_level4>
                    <node_level4>
                        <value animal="dog">Pug</value>
                    </node_level4>
                    <node_level4>
                        <value animal="dog">Beagle</value>
                    </node_level4>
                </node_level3>
            </node_level2>
        </node_level1>

</root>

After transforming the data using XSLT, I need the XML as below:

<root>

        <node_level1>
            <node_level2>
                <node_level3>
                    <value animal="cat">Cat Family</value>
                </node_level3>
                <node_level3>
                    <value animal="cat">Cat Family</value>
                </node_level3>
                <node_level3>
                    <value animal="cat">Cat Family</value>
                </node_level3>
            </node_level2>
            <node_level2>
                <node_level3>
                    <node_level4>
                        <value animal="dog">Dog Family</value>
                    </node_level4>
                    <node_level4>
                        <value animal="dog">Dog Family</value>
                    </node_level4>
                    <node_level4>
                        <value animal="dog">Dog Family</value>
                    </node_level4>
                </node_level3>
            </node_level2>
        </node_level1>

</root>

Here is the code that works for specified attributes, I need to generalize it.

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="xsl" version="2.0">
    <xsl:template match="/">
        <root>
            <xsl:for-each select="//*[value[@animal = 'cat']]">
                <xsl:copy>
                    <xsl:value-of select="@*"/>
                    <xsl:value-of select="'Cat Family'"/>
                </xsl:copy>
            </xsl:for-each>
        </root>
    </xsl:template>
</xsl:stylesheet>

Body:
This is very simple task you need to use identity template to copy of all xml nodes as it  is:

<xsl:template match="@* | node()">
    <xsl:copy>
        <xsl:apply-templates select="@* | node()"/>
    </xsl:copy>
</xsl:template>

Then you can use a seperate template of value element as per your requirement:

<xsl:template match="value">
    <xsl:choose>
        <xsl:when test="@animal = 'cat'">
            <value animal="cat">Cat Family</value>
        </xsl:when>
        <xsl:when test="@animal = 'dog'">
            <value animal="dog">Dog Family</value>
        </xsl:when>
    </xsl:choose>
</xsl:template>

Final XSL file is :

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" exclude-result-prefixes="xsl" version="2.0">

    <!-- indent elements to see properly -->
    <xsl:output indent="yes"/>

    <xsl:template match="@* | node()">
        <xsl:copy>
            <xsl:apply-templates select="@* | node()"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="value">
        <xsl:choose>
            <xsl:when test="@animal = 'cat'">
                <value animal="cat">Cat Family</value>
            </xsl:when>
            <xsl:when test="@animal = 'dog'">
                <value animal="dog">Dog Family</value>
            </xsl:when>
        </xsl:choose>
    </xsl:template>

</xsl:stylesheet>


问:
asyncio.gather throws RuntimeError: Task got bad yield
I want to run a few tasks "in parallel" using asyncio.gather():

import asyncio

async def foo():
    return 42

async def main():
    results = await asyncio.gather(foo() for i in range(10))
    print(results)

asyncio.run(main())
```

<p>But it fails with <code>RuntimeError: Task got bad yield</code>:</p>

```/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/events.py:88: RuntimeWarning: coroutine 'foo' was never awaited
  self._context.run(self._callback, *self._args)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 583, in run_until_complete
    return future.result()
  File "<stdin>", line 2, in main
  File "<stdin>", line 2, in <genexpr>
RuntimeError: Task got bad yield: <coroutine object foo at 0x10555bd40>
```

答:
The function asyncio.gather() accepts each task as separate argument. Like this:

```<code>await asyncio.gather(task1, task2, task3)
</code>```

So the solution is to replace

    results = await asyncio.gather(foo() for i in range(10))
```

<p>with</p>

<pre class="lang-py prettyprint-override"><code>    results = await asyncio.gather(*[foo() for i in range(10)])
</code>```

Body:
I want to run a few tasks "in parallel" using asyncio.gather():

import asyncio

async def foo():
    return 42

async def main():
    results = await asyncio.gather(foo() for i in range(10))
    print(results)

asyncio.run(main())

But it fails with RuntimeError: Task got bad yield:

/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/events.py:88: RuntimeWarning: coroutine 'foo' was never awaited
  self._context.run(self._callback, *self._args)
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/runners.py", line 43, in run
    return loop.run_until_complete(main)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 583, in run_until_complete
    return future.result()
  File "<stdin>", line 2, in main
  File "<stdin>", line 2, in <genexpr>
RuntimeError: Task got bad yield: <coroutine object foo at 0x10555bd40>

Body:
The function asyncio.gather() accepts each task as separate argument. Like this:

await asyncio.gather(task1, task2, task3)

So the solution is to replace

    results = await asyncio.gather(foo() for i in range(10))

with

    results = await asyncio.gather(*[foo() for i in range(10)])


问:
checkbox click event with jquery datatables not working
I have used jQuery Datatables https://datatables.net/ for my grids.
There are two grids, each has a checkbox in the grid. I need to generate an event when checkbox is checked/unchecked.

I have tried this but it doesn't work. Please let me know what I am doing wrong here..........

```<code>  $(document).ready(function () {
            $('.cBSAGrid tr td').click(function (event) {
                alert('0');
            });
        });
</code>```

and

```<code> $(document).ready(function () {
            $('#BSAGrid tr').click(function (event) {
                alert('0');
            });
        });
</code>```

My datatable jquery

```<code>$.ajax({
                type: "POST",
                url: "/BSA/BSAExceptionGrid",
                data: '{ policynumber: "' + txtpolicy.val() + '",clientname:"' + clientname.val() + '" }',
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (response) {
                    div.css("display", "none");

                    $('#BSAGrid').DataTable({
                        paging: false,
                        searching: false,
                        destroy: true,
                        "bInfo" : false,
                        data: response,
                        columns: [
                            { "data": "Logged_ID" },
                            { "data": "Logged_ID" },
                            { "data": "CustomerName" },
                            { "data": "ClientType" }

                        ],
                        aoColumnDefs: [
                        {
                            aTargets: [0],    // Column number which needs to be modified
                            mRender: function (o, v) {   // o, v contains the object and value for the column
                                return '<input type="checkbox" id="chkBSA" name="chkBSA" />';
                            }
                            //,sClass: 'tableCell'       // Optional - class to be applied to this table cell
                        }
                        ,
                         {
                             aTargets: [1],
                             visible: false
                         }
                        ],
                        select: {
                            style: 'os',
                            selector: 'td:first-child'
                        },
                        order: [[1, 'asc']]

                    });

                },
                failure: function (response) {
                    alert(response);
                },
                error: function (response) {
                    alert(response.responseText);
                }
            });
</code>```

HTML

```<code>  <div id="BSAGridContainer" style="display:none;">
       <table id="BSAGrid" class="cBSAGrid table table-responsive">
            <thead>
                <tr>
                    <th></th>
                    <th >Logged_ID</th>
                    <th>Client Name</th>
                    <th>Client Type</th>
                </tr>
            </thead>
        </table>
    </div>
</code>```

答:
If you're using bootstrap 4 custom-checkbox then add a class into your checkbox </p>

```<code>.className {left: 0;z-index: 1;width: 1.25rem;height: 1.25rem;}
</code>```

Body:
I have used jQuery Datatables https://datatables.net/ for my grids.
There are two grids, each has a checkbox in the grid. I need to generate an event when checkbox is checked/unchecked.

I have tried this but it doesn't work. Please let me know what I am doing wrong here..........

  $(document).ready(function () {
            $('.cBSAGrid tr td').click(function (event) {
                alert('0');
            });
        });

and

 $(document).ready(function () {
            $('#BSAGrid tr').click(function (event) {
                alert('0');
            });
        });

My datatable jquery

$.ajax({
                type: "POST",
                url: "/BSA/BSAExceptionGrid",
                data: '{ policynumber: "' + txtpolicy.val() + '",clientname:"' + clientname.val() + '" }',
                contentType: "application/json; charset=utf-8",
                dataType: "json",
                success: function (response) {
                    div.css("display", "none");

                    $('#BSAGrid').DataTable({
                        paging: false,
                        searching: false,
                        destroy: true,
                        "bInfo" : false,
                        data: response,
                        columns: [
                            { "data": "Logged_ID" },
                            { "data": "Logged_ID" },
                            { "data": "CustomerName" },
                            { "data": "ClientType" }

                        ],
                        aoColumnDefs: [
                        {
                            aTargets: [0],    // Column number which needs to be modified
                            mRender: function (o, v) {   // o, v contains the object and value for the column
                                return '<input type="checkbox" id="chkBSA" name="chkBSA" />';
                            }
                            //,sClass: 'tableCell'       // Optional - class to be applied to this table cell
                        }
                        ,
                         {
                             aTargets: [1],
                             visible: false
                         }
                        ],
                        select: {
                            style: 'os',
                            selector: 'td:first-child'
                        },
                        order: [[1, 'asc']]

                    });

                },
                failure: function (response) {
                    alert(response);
                },
                error: function (response) {
                    alert(response.responseText);
                }
            });

HTML

                    Logged_ID
                    Client Name
                    Client Type

Body:
If you're using bootstrap 4 custom-checkbox then add a class into your checkbox

.className {left: 0;z-index: 1;width: 1.25rem;height: 1.25rem;}


问:
removing an item from an array in Vuex
I am just starting using Vuex but am having a problem (and this could be some clueless syntax error on my part). I have a user with liked_items and have a network call that is to unlike an item.

```<code>mutations: {
SET_TOGGLE_LIKED: (state, { global_id }) => {
  alert('here is global_id: ' + global_id)
 state.user.liked_items.find((obj,i) => {
   if(obj.global_id === global_id){ // no global_id
      console.log('that exists at i: ' + i + ' with length: ' + state.user.liked_items.length)
      state.user.liked_items.splice(i, 1)
      console.log('that exists at i: ' + state.user.liked_items.length)
   }else{
     console.log('that doesnot exist!')
   }
 })
}
</code>```

The problem I'm having is that after removing an item from the liked_items list, that seems to get recalled and I get an error that global_id does not exist on undefined.

I am able to fix by having:

```<code> state.user.liked_items.find((obj,i) => {
   if(obj){
     if(obj.global_id === global_id){
</code>```

but why do I need to check for the existence of obj here?

答:
You can use the following mutation, it uses the splice from Javascript array methods.

```<code>deleteElement: function(state.element) {
  state.myArray.splice(this.events.indexOf(element), 1);
}
</code>```

If you know the index of the element, it becomes (obviously):

```<code>deleteElement: function(state,elementIndex) {
  state.myArray.splice(elementIndex, 1);
}
</code>```

"1" is the number of elements to remove, starting from elementIndex

ContentLicense: CC BY-SA 3.0

Title: removing an item from an array in Vuex

Body:
I am just starting using Vuex but am having a problem (and this could be some clueless syntax error on my part). I have a user with liked_items and have a network call that is to unlike an item.

mutations: {
SET_TOGGLE_LIKED: (state, { global_id }) => {
  alert('here is global_id: ' + global_id)
 state.user.liked_items.find((obj,i) => {
   if(obj.global_id === global_id){ // no global_id
      console.log('that exists at i: ' + i + ' with length: ' + state.user.liked_items.length)
      state.user.liked_items.splice(i, 1)
      console.log('that exists at i: ' + state.user.liked_items.length)
   }else{
     console.log('that doesnot exist!')
   }
 })
}

The problem I'm having is that after removing an item from the liked_items list, that seems to get recalled and I get an error that global_id does not exist on undefined.

I am able to fix by having:

 state.user.liked_items.find((obj,i) => {
   if(obj){
     if(obj.global_id === global_id){

but why do I need to check for the existence of obj here?

Body:
You can use the following mutation, it uses the splice from Javascript array methods.

deleteElement: function(state.element) {
  state.myArray.splice(this.events.indexOf(element), 1);
}

If you know the index of the element, it becomes (obviously):

deleteElement: function(state,elementIndex) {
  state.myArray.splice(elementIndex, 1);
}

"1" is the number of elements to remove, starting from elementIndex


问:
skipping login screen in appdelegate not working in swift
I am trying to skip the login screen in appdelegate and i am using world known method of assigning the next view controller to rootviewcontroller but somehow it's not working for testing purposes I have not set any condition and this code is directly executed but doesn't reflect in the app.

my loginViewController is embedded in navigationController

```<code>let storyboard = UIStoryboard(name: "Main", bundle: nil)
let homepage = storyboard.instantiateViewController(withIdentifier: "mainTabBarController") as! mainTabBarController
self.window?.rootViewController = homepage
self.window?.makeKeyAndVisible()
</code>```

I have gone through a lot so answers for this but they are suggesting the same method.

"comment for extra info on the question".

答:
If you are using Xcode 11 and above

Delete SceneDelegate.swift

Delete UISceneSession Lifecycle methods from AppDelegate

Add var window: UIWindow? in AppDelegate class

Open Info.plist and delete Application Scene Manifest

Add the below line in didFinishLaunchingWithOptions method

```<code>self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.rootViewController = //...
self.window?.makeKeyAndVisible()
</code>```

Body:
I am trying to skip the login screen in appdelegate and i am using world known method of assigning the next view controller to rootviewcontroller but somehow it's not working for testing purposes I have not set any condition and this code is directly executed but doesn't reflect in the app.

my loginViewController is embedded in navigationController

let storyboard = UIStoryboard(name: "Main", bundle: nil)
let homepage = storyboard.instantiateViewController(withIdentifier: "mainTabBarController") as! mainTabBarController
self.window?.rootViewController = homepage
self.window?.makeKeyAndVisible()

I have gone through a lot so answers for this but they are suggesting the same method.

"comment for extra info on the question".

Body:
If you are using Xcode 11 and above

Delete SceneDelegate.swift

Delete UISceneSession Lifecycle methods from AppDelegate

Add var window: UIWindow? in AppDelegate class

Open Info.plist and delete Application Scene Manifest

Add the below line in didFinishLaunchingWithOptions method

self.window = UIWindow(frame: UIScreen.main.bounds)
self.window?.rootViewController = //...
self.window?.makeKeyAndVisible()


问:
How to take branch specifier as user input along with other hard coded branch specifiers
I have provided branch specifiers as shown in below image. If I remove the branch specifier with $BRANCH in it, job works perfectly(gets triggered) as anyone commits to develop or feature branches.

Now I also want that same job should also be able to build the project on any specific branch of choice. So I added a branch specifier and put $BRANCH in it. I have defined BRANCH as a string parameter and the user can give branch value as input when triggering the job manually.

But in this scenario even if the user gives a "bugfix112" job is still building develop branch. Or if earlier poll action had built the job on feature branch than even after providing user-input, the job will still build feature branch.

It seems like manual input has no effect. How can I configure a Jenkins job that can be triggered on poll SCM and also with user input for the branch parameter?

i also tried giving */$BRANCH,*/${BRANCH} but no success.

答:
So I had raised above issue with Jenkins git plugin author and it looks that for the above scenario we have to use the multi-branch pipeline. In fact, I agree with the statement.

https://issues.jenkins-ci.org/browse/JENKINS-61074


问:
Batch script to move files that match another set of files?
This would help me a lot of possible.

Example:
Folder1 has 900 files ending in .zip.
Folder2 has 300 files that match the ones in Folder1 but in .doc

How can I create a batch script to move files from Folder1 to Folder1-sorted that only have a .doc alternative ending up with a folder1-sorted with only 300 .zip files?

My initial guess was doing dir > list.txt and changing the extension of every line and using this list to copy.. but I guess there might be a more clever solution to doing this.

答:
With the aid of Setlocal EnableDelayedExpansion and For loops you could build an indexed array whose values contain just the filenames for your .doc files, using the ~n variable modifier, then use another for loop on your .zip files to compare against the array with a nested For /L loop.

EG:

```<code>@ECHO OFF & Setlocal EnableDelayedExpansion
CD "your path for parent directory containing folders 1 and 2"

REM build the array using the smaller data set...

PUSHD Folder2
Set "_I=0"
For %%A in (*.doc) Do (
    Set /A _I+=1
    Set "file[!_I!]=%%~nA"
)
POPD
PUSHD Folder1
For %%A in (*.zip) Do (
    For /L %%B in (1,1,!_I!) Do (
        If "!file[%%B]!"=="%%~nA" (
            ECHO(%%A matches !file[%%B]!.doc
REM command for on Match here
        )
    )
)
POPD

</code>```

Body:
With the aid of Setlocal EnableDelayedExpansion and For loops you could build an indexed array whose values contain just the filenames for your .doc files, using the ~n variable modifier, then use another for loop on your .zip files to compare against the array with a nested For /L loop.

EG:

@ECHO OFF & Setlocal EnableDelayedExpansion
CD "your path for parent directory containing folders 1 and 2"

REM build the array using the smaller data set...

PUSHD Folder2
Set "_I=0"
For %%A in (*.doc) Do (
    Set /A _I+=1
    Set "file[!_I!]=%%~nA"
)
POPD
PUSHD Folder1
For %%A in (*.zip) Do (
    For /L %%B in (1,1,!_I!) Do (
        If "!file[%%B]!"=="%%~nA" (
            ECHO(%%A matches !file[%%B]!.doc
REM command for on Match here
        )
    )
)
POPD


问:
Can someone help me with this linked list? C++
I have an object oriented exam tomorrow and I'm still stuck with linked lists. For some reason I cant quite understand how they work or how to implement them properly. I've watched a lot of videos and tutorials but it still is quite complex. I always get an error which prints nothing to the console, just a blank black page. Can someone tell em what am I doing wrong?
Thank you.</p>

```<code>#include <iostream>
#include <string>

using namespace std;

struct node
{
    string name;
    int number;
    node* next;
};
struct node* head = 0;

class Employees
{
private:
    node* head, * tail;
public:
    Employees()
    {
        head = NULL;
        tail = NULL;
    }
    void addToList(string Name, int Num)
    {
        node* n = new node;
        n->name = Name;
        n->number = Num;
        n->next = NULL;
        if (head == NULL)
        {
            head = n;
            tail = n;
        }
        else
        {
            tail->next = n;
            tail = tail->next;
        }
    }
    void PrintAll()
    {
        while (head != NULL)
        {
            node* current;
            while (current != NULL)
            {
                cout << current->name << "\t";
                cout << current->number;
            }
        }
    }
};

int main()
{
    Employees a;
    a.addToList("Robert", 54);
    a.addToList("Manny", 77);

    a.PrintAll();

}
</code>```

答:
The primary problem with your code is that your PrintAll method is written incorrectly and you never update your current pointer. Perhaps you've not been taught for loops yet, but this is an ideal case for them:

```<code>for(node* current = head; current != NULL; current = current->next) {
  cout << current->name << "\t" << current->number;
}
</code>```

The first part of the for loop initialises the variable (which you neglected to do in your code), the next is the end condition (as you'd find in a while loop), and the third part updates the variable each cycle through the loop thus traversing your loop from start to end.

You can do all this with a while loop but it expresses your intent less clearly, so a for loop should be preferred. I am also not sure why you have a while loop checking whether head is null? Since it does not change during the loop, there is no need to repeatedly check it, and - in any case - there is no advantage to checking it separately as opposed to simply checking current once it has been initialised to head.

As a minor note, if you're using a modern C++ version, nullptr should be preferred over NULL.

Body:
I have an object oriented exam tomorrow and I'm still stuck with linked lists. For some reason I cant quite understand how they work or how to implement them properly. I've watched a lot of videos and tutorials but it still is quite complex. I always get an error which prints nothing to the console, just a blank black page. Can someone tell em what am I doing wrong?
Thank you.

#include <iostream>
#include <string>

using namespace std;

struct node
{
    string name;
    int number;
    node* next;
};
struct node* head = 0;

class Employees
{
private:
    node* head, * tail;
public:
    Employees()
    {
        head = NULL;
        tail = NULL;
    }
    void addToList(string Name, int Num)
    {
        node* n = new node;
        n->name = Name;
        n->number = Num;
        n->next = NULL;
        if (head == NULL)
        {
            head = n;
            tail = n;
        }
        else
        {
            tail->next = n;
            tail = tail->next;
        }
    }
    void PrintAll()
    {
        while (head != NULL)
        {
            node* current;
            while (current != NULL)
            {
                cout << current->name << "\t";
                cout << current->number;
            }
        }
    }
};

int main()
{
    Employees a;
    a.addToList("Robert", 54);
    a.addToList("Manny", 77);

    a.PrintAll();

}

Body:
The primary problem with your code is that your PrintAll method is written incorrectly and you never update your current pointer. Perhaps you've not been taught for loops yet, but this is an ideal case for them:

for(node* current = head; current != NULL; current = current->next) {
  cout << current->name << "\t" << current->number;
}

The first part of the for loop initialises the variable (which you neglected to do in your code), the next is the end condition (as you'd find in a while loop), and the third part updates the variable each cycle through the loop thus traversing your loop from start to end.

You can do all this with a while loop but it expresses your intent less clearly, so a for loop should be preferred. I am also not sure why you have a while loop checking whether head is null? Since it does not change during the loop, there is no need to repeatedly check it, and - in any case - there is no advantage to checking it separately as opposed to simply checking current once it has been initialised to head.

As a minor note, if you're using a modern C++ version, nullptr should be preferred over NULL.


问:
Extracting numerical data from string
I have text data in a csv file in this format:

76.76% @ 26.2° C D: 20.7° C G/KG: 15.5

Date,Value,Formatted Value

2019-10-11 14:50:00,71.19,71.19% @ 24.4° C D: 17.7° C G/KG: 12.8

2019-10-11 15:00:00,72.2,72.2% @ 24.4° C D: 17.9° C G/KG: 13

2019-10-11 15:10:00,71.35,71.35% @ 24.4° C D: 17.8° C G/KG: 12.9

I would like to extract the each numerical data and store it in a different column. The numbers don't always contain a decimal place though.

Edit: The data is from a csv file and I would like to store each numerical data in a different column.

答:
In this example i get the data as string and used split(' '). You can use sep=' ' for get data from csv file. Also i've used regex you need the import it as import re

```<code>data = '76.76% @ 26.2° C D: 20.7° C G/KG: 15.5'
data = data.split(' ')
data = [re.sub("[^0-9.]", "", x) for x in data]
data = [x for x in data if x != '']

temp_dict = {}
for i, item in enumerate(data):
    temp_dict[f'col_{i}'] = item

df = pd.DataFrame([temp_dict])
</code>```

Output:

```<code>   col_0 col_1 col_2 col_3
0  76.76  26.2  20.7  15.5
</code>```

Update

This can be more useful.

```<code>df[['col1', 'col2', 'col3', 'col4']] = df['Formatted Value'].str.extractall('(\d+.\d+)').unstack().loc[:, 0]
</code>```

Update 2

This code works with decimal and int values.

```<code>df = pd.read_csv('test.csv')
my_list = df['Formatted Value'].apply(lambda x: re.findall(r'[\d\.\d]+', x))
d = {'Extractted': my_list}
temp_df = pd.DataFrame(d)
df[['col1', 'col2', 'col3', 'col4']] = pd.DataFrame(temp_df['Extractted'].values.tolist(), index=temp_df.index)
</code>```

Title: Extracting numerical data from string

Body:
In this example i get the data as string and used split(' '). You can use sep=' ' for get data from csv file. Also i've used regex you need the import it as import re

data = '76.76% @ 26.2° C D: 20.7° C G/KG: 15.5'
data = data.split(' ')
data = [re.sub("[^0-9.]", "", x) for x in data]
data = [x for x in data if x != '']

temp_dict = {}
for i, item in enumerate(data):
    temp_dict[f'col_{i}'] = item

df = pd.DataFrame([temp_dict])

Output:

   col_0 col_1 col_2 col_3
0  76.76  26.2  20.7  15.5

Update

This can be more useful.

df[['col1', 'col2', 'col3', 'col4']] = df['Formatted Value'].str.extractall('(\d+.\d+)').unstack().loc[:, 0]

Update 2

This code works with decimal and int values.

df = pd.read_csv('test.csv')
my_list = df['Formatted Value'].apply(lambda x: re.findall(r'[\d\.\d]+', x))
d = {'Extractted': my_list}
temp_df = pd.DataFrame(d)
df[['col1', 'col2', 'col3', 'col4']] = pd.DataFrame(temp_df['Extractted'].values.tolist(), index=temp_df.index)


问:
Li click is not working with select2 plugin
I have a select menu built with select2 plugin. I need to add a class to <select> when click menu options. Tested with alert it's not working.

https://jsfiddle.net/ysm4qhof/1/

```<code>$(document).ready(function(){
$('.select2-results__option').on('click', function(){
   alert("Hello! I am an alert box!");
});
});
</code>```

Tried with clicking ul but that also not working.

```<code>$(document).ready(function(){
    $('.select2 .select2-results__options').on('click', function(){
       alert("Hello! I am an alert box!");
    });
    });
</code>```

It should be working but what am I missing here?

答:
this is working , first change selector to js-select2 because this class name you using for select  name and for select field use change function insted of click

```<code>$(document).ready(function(){
$('.js-select2').on('change', function(){
alert("Hello! I am an alert box!");
});
});
</code>```

Body:
I have a select menu built with select2 plugin. I need to add a class to <select> when click menu options. Tested with alert it's not working.

https://jsfiddle.net/ysm4qhof/1/

$(document).ready(function(){
$('.select2-results__option').on('click', function(){
   alert("Hello! I am an alert box!");
});
});

Tried with clicking ul but that also not working.

$(document).ready(function(){
    $('.select2 .select2-results__options').on('click', function(){
       alert("Hello! I am an alert box!");
    });
    });

It should be working but what am I missing here?

Body:
this is working , first change selector to js-select2 because this class name you using for select  name and for select field use change function insted of click

$(document).ready(function(){
$('.js-select2').on('change', function(){
alert("Hello! I am an alert box!");
});
});


问:
VBA Regex only returns the last match
I'm trying to find all occurrences of terms that are found in quotes inside brackets ("TERM TO BE FOUND"), whether there are other words in the brackets or not (this is also a "TERM TO BE FOUND").

The content of my ActiveDocument is:

```<code>This is a ("Test") and another (second "Test2")
</code>```

My code is:

```<code>Dim regEx As Object
Dim matchCollection As Object
Dim extractedString As String
Dim match As Object
Dim RealQ
Dim n As Integer

RealQ = Chr(34)

Set regEx = CreateObject("VBScript.RegExp")
With regEx
  .IgnoreCase = IgnoreCase
  .Global = True
  .MultiLine = True
  .Pattern = "\(.*" & RealQ & "(.*)" & RealQ & "\)"
End With

Set matchCollection = regEx.Execute(ActiveDocument.Content.Text)

extractedString = ""

For Each match In matchCollection

    Debug.Print (match.submatches(0))

Next
</code>```

The above only finds the last occurrence, i.e. "Test2". What am I missing?

Thanks a lot!!

答:
You don't need RegEx for this! It can all be done with Word's own wildcard Find tools. For example:

```<code>Sub Demo()
Application.ScreenUpdating = False
Dim StrFnd As String, i As Long
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "\(*[^34][!\)]@[^34]*\)"
    .Replacement.Text = ""
    .MatchWildcards = True
    .Wrap = wdFindStop
    .Forward = True
    .Format = False
    .Execute
  End With
  Do While .Find.Found
    i = i + 1
    StrFnd = StrFnd & vbCr & Split(.Text, """")(1)
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
End With
Application.ScreenUpdating = True
MsgBox i & " instances found:" & StrFnd
End Sub
</code>```

More complex code could be used to handle content with smart quotes also.

Title: VBA Regex only returns the last match

Body:
I'm trying to find all occurrences of terms that are found in quotes inside brackets ("TERM TO BE FOUND"), whether there are other words in the brackets or not (this is also a "TERM TO BE FOUND").

The content of my ActiveDocument is:

This is a ("Test") and another (second "Test2")

My code is:

Dim regEx As Object
Dim matchCollection As Object
Dim extractedString As String
Dim match As Object
Dim RealQ
Dim n As Integer

RealQ = Chr(34)

Set regEx = CreateObject("VBScript.RegExp")
With regEx
  .IgnoreCase = IgnoreCase
  .Global = True
  .MultiLine = True
  .Pattern = "\(.*" & RealQ & "(.*)" & RealQ & "\)"
End With

Set matchCollection = regEx.Execute(ActiveDocument.Content.Text)

extractedString = ""

For Each match In matchCollection

    Debug.Print (match.submatches(0))

Next

The above only finds the last occurrence, i.e. "Test2". What am I missing?

Thanks a lot!!

Body:
You don't need RegEx for this! It can all be done with Word's own wildcard Find tools. For example:

Sub Demo()
Application.ScreenUpdating = False
Dim StrFnd As String, i As Long
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = "\(*[^34][!\)]@[^34]*\)"
    .Replacement.Text = ""
    .MatchWildcards = True
    .Wrap = wdFindStop
    .Forward = True
    .Format = False
    .Execute
  End With
  Do While .Find.Found
    i = i + 1
    StrFnd = StrFnd & vbCr & Split(.Text, """")(1)
    .Collapse wdCollapseEnd
    .Find.Execute
  Loop
End With
Application.ScreenUpdating = True
MsgBox i & " instances found:" & StrFnd
End Sub

More complex code could be used to handle content with smart quotes also.