Skip to content

Instantly share code, notes, and snippets.

@PeterTillema
Last active September 29, 2021 07:18
Show Gist options
  • Save PeterTillema/215f0a6474849a06001e10804e5a6eca to your computer and use it in GitHub Desktop.
Save PeterTillema/215f0a6474849a06001e10804e5a6eca to your computer and use it in GitHub Desktop.
String array to char array
[[[['a' 'b']
['c' 'd']
['e' 'f']
['g' 'h']
['i' 'j']]
[['k' 'l']
['m' 'n']
['o' 'p']
['q' 'r']
['s' 't']]
[['u' 'v']
['w' 'x']
['y' 'z']
['1' '2']
['3' '4']]
[['5' '6']
['7' '8']
['9' 'a']
['b' 'c']
['d' 'e']]]
[[['f' 'g']
['h' 'i']
['j' 'k']
['l' 'm']
['n' 'o']]
[['p' 'q']
['r' 's']
['t' 'u']
['v' 'w']
['x' 'y']]
[['z' '1']
['2' '3']
['4' '5']
['6' '7']
['8' '9']]
[['A' 'B']
['C' 'D']
['E' 'F']
['G' 'H']
['I' 'J']]]
[[['K' 'L']
['M' 'N']
['O' 'P']
['Q' 'R']
['S' 'T']]
[['U' 'V']
['W' 'X']
['Y' 'Z']
['9' 'A']
['B' 'C']]
[['D' 'E']
['F' 'G']
['H' 'I']
['J' 'K']
['L' 'M']]
[['N' 'O']
['P' 'Q']
['R' 'S']
['T' 'U']
['V' 'W']]]]
# should have quotes around all elements
array([[[[a, c, e, g, i],
[k, m, o, q, s],
[u, w, y, 1, 3],
[5, 7, 9, b, d]],
[[b, d, f, h, j],
[l, n, p, r, t],
[v, x, z, 2, 4],
[6, 8, a, c, e]]],
[[[f, h, j, l, n],
[p, r, t, v, x],
[z, 2, 4, 6, 8],
[A, C, E, G, I]],
[[g, i, k, m, o],
[q, s, u, w, y],
[1, 3, 5, 7, 9],
[B, D, F, H, J]]],
[[[K, M, O, Q, S],
[U, W, Y, 9, B],
[D, F, H, J, L],
[N, P, R, T, V]],
[[L, N, P, R, T],
[V, X, Z, A, C],
[E, G, I, K, M],
[O, Q, S, U, W]]]])
a = np.array([[["ab", "cd", "ef", "gh", "ij"],
["kl", "mn", "op", "qr", "st"],
["uv", "wx", "yz", "12", "34"],
["56", "78", "9a", "bc", "de"]],
[["fg", "hi", "jk", "lm", "no"],
["pq", "rs", "tu", "vw", "xy"],
["z1", "23", "45", "67", "89"],
["AB", "CD", "EF", "GH", "IJ"]],
[["KL", "MN", "OP", "QR", "ST"],
["UV", "WX", "YZ", "9A", "BC"],
["DE", "FG", "HI", "JK", "LM"],
["NO", "PQ", "RS", "TU", "VW"]]])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment